Django 访问admin提示ViewDoesNotExist at /admin/
ViewDoesNotExist at /admin/
Could not import django.views.generic.simple.redirect_to. Parent module django.views.generic.simple does not exist. Request Method: GET Request URL: http://127.0.0.1:8888/admin/ Django Version:1.7.8 Exception Type:ViewDoesNotExist Exception Value: Could not import django.views.generic.simple.redirect_to. Parent module django.views.generic.simple does not exist. Exception Location: C:\Python27\lib\site-packages\django-1.7.8-py2.7.egg\django\core\urlresolvers.py in get_callable, line 104 Python Executable: C:\Python27\python.exe Python Version:2.7.9 Python Path: ['D:\\samcao\\mailclient', 'C:\\Python27\\lib\\site-packages\\django-1.7.8-py2.7.egg', 'C:\\Windows\\system32\\python27.zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages'] Server time: Sat, 13 Jun 2015 17:06:45 +0800
最终检查发现是由于urls.py中的url设置有问题:
urlpatterns = patterns('', # Examples: # url(r'^$', 'mailclient.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^favicon\.ico$','django.views.generic.simple.redirect_to',{'url':'/static/images/favicon.ico'}), )
上面因为之前配置ICO文件时有配置
django.views.generic.simple.redirect_to
测试有误.将其删除掉.恢复正常.
最终截图
![](http://upload-images.jianshu.io/upload_images/433746-ad44e93c87d14c65.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)