`
mr.zxing
  • 浏览: 68668 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

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

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

在urls.py中添加:from django.contrib import admin
二、增加超级用户
manage.py shell
>>>from django.contrib.auth.create_superuser import createsuperuser
>>>createsuperuser()
以上语句可能不能执行,可以改为执行:>>>python manage.py createsuperuser


 进入admin管理页面,想将英文显示中文化:
将settings.py中 LANGUAGE_CODE


 由 'en-us'


 改为 'zh-cn'


 , TIME_ZONE


 建议改为 'CCT'



分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics