Django应用程序,用于添加类似Facebook的按钮
django-like-button的Python项目详细描述
类似于django的按钮使在django应用程序中使用类似于facebook的按钮变得很容易。你只需要做以下事情。
文档
文档现在可以在readthedocs中找到:https://readthedocs.org/projects/django-like-button/
安装
使用简易安装程序或PIP安装类似django的按钮:
pip install django-like-button
在Django设置文件中的已安装应用程序中添加“喜欢”按钮:
INSTALLED_APPS = ( # all # other # apps 'like_button', )
使用Facebook应用程序ID将“Facebook应用程序ID”设置添加到Django设置文件中。
in settings.py:
FACEBOOK_APP_ID = "your appID" FACEBOOK_SHOW_SEND = "true" # or "false, default is "true" FACEBOOK_LIKE_WIDTH = "450" # "numeric value for width", default is 450 FACEBOOK_SHOW_FACES = "true" # or "false, default is "true" FACEBOOK_FONT = "font" # default is "arial"
在主体标记之前,将模板标记代码添加到基础模板中。
In the template, in which you want to add button load tags:
{% load like_button %}
Where you need the like button:
{% like_button_tag %}
At the bottom of the page before the </body> tag put this (you only need to do this once):
{% like_button_js_tag %}
5个。将url添加到url文件中。这试图解决发现的问题 这里有像button这样的facebook:http://stackoverflow.com/questions/2955012/facebook-javascript-sdk-fb-xd-fragment
in urls.py:
url(r'', include('like_button.urls')),