pip install django
1. 创建项目
django-admin startproject mysite
cd mysite
# 2. 创建应用 (例如叫 'hello')
python manage.py startapp hello
python manage.py runserver
python manage.py migrate
python manage.py createsuperuser
在终端(确保在项目目录下)运行:
python manage.py makemigrations
同步到数据库(执行迁移):
现在重启服务器(如果没重启的话),访问 http://127.0.0.1:8000/admin/。
登录后,你应该能看到一个名为 “人物信息” 的模块,点击进去就可以添加数据了!
让我们保持学习热情,多做练习。我们下期再见!