让django-registration和django-profile一起工作

6
我正在设置一个新的django项目,并想使用提供的应用程序django-registration和django-profile。我使用easy-install安装了它们两个,并成功地使django-registration工作。我的下一步是将django-profile应用连接到工作分支。django-registration提供了一项服务,重定向到在settings.py变量LOGIN_REDIRECT_URL中定义的URL。我猜想,我可以简单地粘贴django-profile应用的URL来连接两者(例如'/profiles/')。我的settings.py变量AUTH_PROFILE_MODULE设置为'registration.User'(尝试使用django-registration模型!)。但是我收到了一个SiteProfileNotAvailable at /profiles/的错误,没有提供异常。我尝试遵循以下步骤:https://bitbucket.org/ubernostrum/django-registration/src/tip/docs/index.rsthttps://bitbucket.org/ubernostrum/django-profiles/src/tip/docs/overview.txt但我不确定是否做得正确,特别是来自overview.txt的这段话
对于默认使用,请为您的站点创建一个配置文件模型,并适当地指定AUTH_PROFILE_MODULE设置。然后将profiles添加到您的INSTALLED_APPS设置中,创建适当的模板并设置URL。为了方便链接到配置文件,您的配置文件模型应定义一个get_absolute_url()方法,该方法路由到视图profiles.views.profile_detail,传递用户名。
所以我的问题是:
  • 这是一个众所周知的错误吗?
  • 将'registration.User'设置为AUTH_PROFILE_MODULE的正确方法是什么?
  • 概述.txt中的“应定义一个get_absolute_url()方法,该方法路由到视图profiles.views.profile_detail,传递用户名”是什么意思?
1个回答

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接