python django NameError: name 'admin' is not

来源:互联网 发布:网店排名优化 编辑:程序博客网 时间:2024/05/22 10:38

步骤:

1、修改settings.py。在INSTALLED_APPS设置中添加“django.contrib.admin”。

2、运行python manage.py syncdb更新数据库

3、修改urls.py。改为:

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

 

# Uncomment this for admin:
 
  (r'^admin/',include('django.contrib.admin.urls')),
 
  去掉注释。

在运行时,遇到这种问题:注意空格的问题

0 0