相关疑难解决方法(0)

让Django的@login_required装饰器工作还需要做些什么?

我正在尝试使用Django的帐户系统,包括@login_required装饰器.我的settings.py文件包含django.contrib.auth,我已经完成了syncdb.

Page not found (404)
Request Method: GET
Request URL:    http://localhost:8000/accounts/login/?next=/
Using the URLconf defined in dashboard.urls, Django tried these URL patterns, in this order:
^$ [name='home']
The current URL, accounts/login/, didn't match any of these.
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
Run Code Online (Sandbox Code Playgroud)

在尝试@ login_required-decorate我的主视图后,我看到了上面的内容.

它似乎很窒息,因为它被重定向到accounts/login /,我还没有在urls.py中准备好.

我可以添加到urls.py或其他地方,以便login_required装饰器将执行其通常的行为?

谢谢,

python django django-authentication

11
推荐指数
1
解决办法
1万
查看次数

Django是否附带用于django.contrib.auth模块的身份验证模板?

我在tests目录下找到了一些,但我不确定它们是否是正确的.

通过认证的模板我的意思是login.htm,password_reset.htm

一些模板可以在以下网址找到:http://devdoodles.wordpress.com/2009/02/16/user-authentication-with-django-registration/

python django django-contrib

8
推荐指数
4
解决办法
1万
查看次数