• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >python > DJANGO-ALLAUTH社交用户系统的安装配置

DJANGO-ALLAUTH社交用户系统的安装配置

作者:hebedich 字体:[增加 减小] 来源:互联网

hebedich 通过本文主要向大家介绍了用户最多的社交软件,社交和用户行为分析,中国社交网络用户数量,中国社交网络用户,社交软件用户排行等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

DJANGO-ALLAUTH是github上面排名较高的django user系统.本来通过对比是想选用django-userea的,可是博主智商不够看懂它的安装配置文档.....搞乱了一个测试项目之后,只好作罢.好在allauth安装配置相对简单.但是它的文档写得更乱...很多关键信息居然是在常见问题里面找到...记录下来备忘.

1.安装:

pip install django-allauth
</div>

2.配置

settings.py

TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.tz",
#"django.contrib.messages.context_processors.messages"
# Required by allauth template tags
"django.core.context_processors.request",
# allauth specific context processors
"allauth.account.context_processors.account",
"allauth.socialaccount.context_processors.socialaccount",
)

AUTHENTICATION_BACKENDS = (
# Needed to login by username in Django admin, regardless of `allauth`
"django.contrib.auth.backends.ModelBackend",

# `allauth` specific authentication methods, such as login by e-mail
"allauth.account.auth_backends.AuthenticationBackend",
)

INSTALLED_APPS = (
...
# The Django sites framework is required
'django.contrib.sites',

'allauth',
'allauth.account',
'allauth.socialaccount',
# ... include the providers you want to enable:
'allauth.socialaccount.providers.amazon',
'allauth.socialaccount.providers.angellist',
'allauth.socialaccount.providers.bitbucket',
'allauth.socialaccount.providers.bitly',
'allauth.socialaccount.providers.coinbase',
'allauth.socialaccount.providers.dropbox',
'allauth.socialaccount.providers.facebook',
'allauth.socialaccount.providers.flickr',
'allauth.socialaccount.providers.feedly',
'allauth.socialaccount.providers.github',
'allauth.socialaccount.providers.google',
'allauth.socialaccount.providers.hubic',
'allauth.socialaccount.providers.instagram',
'allauth.socialaccount.providers.linkedin',
'allauth.socialaccount.providers.linkedin_oauth2',
'allauth.socialaccount.providers.openid',
'allauth.socialaccount.providers.persona',
'allauth.socialaccount.providers.soundcloud',
'allauth.socialaccount.providers.stackexchange',
'allauth.socialaccount.providers.tumblr',
'allauth.socialaccount.providers.twitch',
'allauth.socialaccount.providers.twitter',
'allauth.socialaccount.providers.vimeo',
'allauth.socialaccount.providers.vk',
'allauth.socialaccount.providers.weibo',
'allauth.socialaccount.providers.xing',
...
)
</div>

urls.py:

urlpatterns = patterns('',
...
(r'^accounts/', include('allauth.urls')),
...
)
</div>

到此配置好了settings和url,在terminal里面输入

python manage.py makemigrations
python manage.py migrate
</div>
3.初始化使用

启动本地服务器,后 登陆admin

将用户系统将要服务的网站id确定为当前设置里面设置的网站id
为每一个oauth登陆的接口设置一个socialaccount app
将site和接口提供商的信息填入

此时访问

http://127.0.0.1:8000/accounts/login/
如果之前登陆过 请先访问
http://127.0.0.1:8000/accounts/logout/
就可以看到没有css的默认登陆页面了.可以重写,代码在

PATH\TO\YOUR\VIRTUALENV\Lib\site-packages\allauth\templates
各个社交网站接口提供商设置在此
http://django-allauth.readthedocs.org/en/latest/providers.html
比较本地化的只有微博和live...github可以算么 O(∩_∩)O

以上就是个人对于Django-allauth的使用经验及配置,如有错误,还请指正

</div>

您可能想查找下面的文章:

  • DJANGO-ALLAUTH社交用户系统的安装配置

相关文章

  • Python中的FTP通信模块ftplib的用法整理
  • 用Python计算三角函数之atan()方法的使用
  • python使用urllib2提交http post请求的方法
  • python实现颜色rgb和hex相互转换的函数
  • Python实现求最大公约数及判断素数的方法
  • python抓取某汽车网数据解析html存入excel示例
  • Python基于Tkinter的HelloWorld入门实例
  • python使用内存zipfile对象在内存中打包文件示例
  • 王纯业的Python学习笔记 下载
  • python编写爬虫小程序

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • Python数据类型详解(四)字典:dict
    • python求crc32值的方法
    • Python中datetime模块参考手册
    • Go语言基于Socket编写服务器端与客户端通信的实例
    • 基python实现多线程网页爬虫
    • 举例详解Python中循环语句的嵌套使用
    • python实现的希尔排序算法实例
    • Python中基本的日期时间处理的学习教程
    • python中urllib模块用法实例详解
    • python 捕获 shell/bash 脚本的输出结果实例

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有