1、安装
sudo pip3 install Django
2、新建一个服务
sudo django-admin.py startproject djangoproject
cd djangoproject
3、运行服务
sudo python3 manage.py runserver
4、遇到的问题
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
解决办法:
a. 确定目前虚拟环境及对应版本中是否有Django
b. site-packages中是否有以下两个文件
c. 检查Django版本,进行版本更新(成功)
d.我觉得不错的方法,还没有尝试
sudo python3 manage.py runserver
5、成功
System check identified no issues (0 silenced).
You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
August 20, 2020 - 06:33:02
Django version 3.1, using settings 'djangoProject.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.