一、环境问题
安装了python2.7和python3.7。
要兼容,直接把python3.7下的python.exe重命名为python3.exe
配置下环境变量path:C:\Python37-32\ 和 C:\Python37-32\Scripts
二、安装django,用的setup安装,直接到文件所在路径下:python3 setup.py install
配置环境变量:C:\Python37-32\Lib\site-packages\Django-2.0-py3.7.egg\django\bin
三、cmd初步运行 : django-admin.py startproject hello
报错:
Traceback (most recent call last):
File "C:\Python37-32\Lib\site-packages\Django-2.0-py3.7.egg\django\bin\django-admin.py", line 2, in <module>
from django.core import management
ImportError: No module named django.core
原因:因为是双python,识别不了。改成如下:
python3 C:\Python37-32\Lib\site-packages\Django-2.0-py3.7.egg\django\bin\django-admin.py startproject hello
没问题
cd 进入到hello,然后:python3 manage.py runserver
报:
Performing system checks...
System check identified no issues (0 silenced).
You have 14 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.
December 06, 2017 - 21:40:13
Django version 2.0, using settings 'hello.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
四、简单验证:http://127.0.0.1:8000/
The install worked successfully! Congratulations!