1.环境安装
先把项目git clone 到本地磁盘
1.1 安装python环境
环境要求在 requirements.txt 中 参照项目https://github.com/mdn/django-locallibrary-tutorial 的步骤,执行以下命令,注意以管理员身份运行终端
pip install -r requirements.txt
python manage.py makemigrations
python manage.py migrate
python manage.py collectstatic
python manage.py test # Run the standard tests. These should all pass.
python manage.py createsuperuser # Create a superuser
python manage.py runserver
但是执行 python manage.py migrate
在 Windows 上失败并显示以下消息
(fields.E180) SQLite does not support JSONFields.
解决参考:https://www.coder.work/article/7751912
将python下的dll文件进行替换
1.2 测试
- Open a browser to
http://127.0.0.1:8000/admin/
to open the admin site - Create a few test objects of each type
- Open tab to
http://127.0.0.1:8000
to see the main site, with your new objects
但是打开主页面http://127.0.0.1:8000
时出错