NameError: name 'admin' is not defined

步骤:

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')),
   去掉注释。

你可能感兴趣的:(python,django)