ImportError "No module named django.contrib.auth"
当我尝试使用该django.shortcuts
redirect
功能和尝试使用时,我都得到了:
(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page': '/'}),
我认为我遇到此错误的唯一地方是页面被重定向的地方并不是巧合,但也许确实如此。我知道用户实际上并没有被注销,所以在你到达任何重定向代码之前就发生了错误。
下面是我的 urls.py 文件。
import django.contrib.auth.views
from django.conf.urls.defaults import *
import django.contrib.auth
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('karma.views',
(r'^$', 'homepage'),
(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page': '/'}),
(r"^opportunities/nearby$", 'draw_map'),
(r'^admin/', include(admin.site.urls)),
url(r'', include('social_auth.urls')),
(r'^profile/', include('karmup.profile.urls')),
)