[英]Cannot access my django admin panel
Urls.py Urls.py
from django.conf import settings
from django.conf.urls import patterns, include, url
from basic_code.settings import STATIC_ROOT
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/doc/' , include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
(r'media(?P<path>. *)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
(r'static(?P<path>. *)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),
url(r'^$', 'contact.views.home'),
url(r'^static/(.*)$', 'django.views.static.serve', {'document_root': STATIC_ROOT, 'show_indexes' : True}),
url(r'^templates/$', 'templates.welcome', name="welcome"),
) )
settings.py installed apps settings.py已安装的应用
'django.contrib.admin',
I have syncdb and collectstatic before making edits to urls and settings. 在对网址和设置进行修改之前,我已使用syncdb和collectstatic。 Now terminal shows
现在终端显示
$ python2.7 manage.py collectstatic
Unknown command: 'collectstatic'
Type 'manage.py help' for usage.
when I collect static. 当我收集静电时。
and when I go to www.website.com/admin I get: 当我访问www.website.com/admin时,我得到:
ImportError at /admin/
No module named templates
Request Method: GET
Request URL: http://www.website.com/admin/
Django Version: 1.5
Exception Type: ImportError
Exception Value:
No module named templates
Exception Location: /home/user/webapps/appname/lib/python2.7/django/utils/importlib.py in import_module, line 35
Python Executable: /usr/local/bin/python
Python Version: 2.7.5
Thank you in advance! 先感谢您!
Check your module templates
检查您的模块
templates
Problem is in following line: 问题在以下几行:
url(r'^templates/$', 'templates.welcome', name="welcome"),
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.