无法访问我的django管理面板

时间:2014-01-06 02:57:41

标签: python django django-templates django-admin

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已安装的应用

'django.contrib.admin',

我在编辑网址和设置之前有syncdb和collectstatic。 现在终端显示

$ python2.7 manage.py collectstatic
Unknown command: 'collectstatic'
Type 'manage.py help' for usage.

当我收集静电时。

当我去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 

提前谢谢!

1 个答案:

答案 0 :(得分:0)

检查您的模块templates

问题出在以下几行:

url(r'^templates/$', 'templates.welcome', name="welcome"),
相关问题