django admin
1. 在urls.py激活admin
2. 创建管理员 ./manager.py createsuperuser 出现如下错误!
'Did you install mysqlclient or MySQL-python?' % e django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'. Did you install mysqlclient or MySQL-python?
vim mysite/__init__.py 加入
import pymysql pymysql.install_as_MySQLdb()
create database mysite_db charset=utf8
settings.py设置
python3 manage.py migrate
python3 manage.py createsuperuser 成功创建超级用户
3. 注册models到admin中
4. 登陆后台对models进行编辑