environment:
Windows 7 Professional Edition, pycharm, django2.0 (note that the following .py is not required when entering commands under windows, as follows)
Create engineering project
Create a new project and enter at the command line:
django-admin startproject django_site
Create a new App and enter at the command line:
django-admin startapp blog
Then enter the tree command to view the current folder and find that many files are automatically created.
Create database tables or alter database tables or fields
# 1. 创建更改的文件
python manage.py makemigrations
# 2. 将生成的py文件应用到数据库
python manage.py migrate
运行后出现如下输出:
清空数据表python manage.py flush
,选择yes
然后创建超级管理员,输入 python manage.py createsuperuser
, 用户名密码必须输入,邮箱可以不输入,输入密码时不显示。
# 修改用户密码可以用:
python manage.py changepassword username