获取django-registration和django-profile一起工作

时间:2011-10-17 23:02:16

标签: python django authentication django-registration

我正在设置一个新的django项目,我想使用提供的应用程序django-registration和django-profile。我安装了两个易于安装和管理,以使django注册工作正常。我的下一步是将django-profile应用程序连接到工作分支。 django-registration提供了一个服务,该服务重定向到URL,该URL在settings.py-variable LOGIN_REDIRECT_URL中定义。我的猜测是,我可以简单地粘贴django-profile app的url来连接两者。 (例如'/ profiles /')。 我在“registration.User”上设置了settings.py-variable AUTH_PROFILE_MODULE,(尝试使用django-registration模型!)。 但我得到了一个     SiteProfileNotAvailable at / profiles /     没有例外 错误。 我试着按照以下步骤操作: https://bitbucket.org/ubernostrum/django-registration/src/tip/docs/index.rst https://bitbucket.org/ubernostrum/django-profiles/src/tip/docs/overview.txt 但我不确定,如果我做的一切都正确,即overview.txt

中的这一段
  

默认使用,为您的站点创建配置文件模型并指定   AUTH_PROFILE_MODULE设置得当。然后添加profiles   在INSTALLED_APPS设置中,创建相应的模板   并设置URL。为方便链接到个人资料,您的   profile模型应该定义一个get_absolute_url()方法   通过视图profiles.views.profile_detail的路线   用户名。

所以我的问题是:

  • 这是一个众所周知的错误吗?
  • 将'registration.User'设置为AUTH_PROFILE_MODULE是正确的方法吗?
  • 什么是“应该定义一个get_absolute_url()方法 通过视图profiles.views.profile_detail的路线 用户名。“在overview.txt中?

1 个答案:

答案 0 :(得分:3)

由于文档类型和缺少模板,django-registration很难使用。许多Django开发人员现在使用django-social-auth代替:

https://github.com/omab/django-social-auth http://django-social-auth.readthedocs.org/en/latest/index.html

你可以看到Kenneth Love如何将它集成到Django Packages代码库中:

https://github.com/opencomparison/opencomparison/blob/master/apps/profiles/views.py#L83 https://github.com/opencomparison/opencomparison/blob/master/settings.py#L277