windows python3.7+Django2.0

  1. 安装python3.7

参考资料:https://jingyan.baidu.com/article/3ea51489bebde652e61bbad3.html

要直接使用python执行命令,添加环境变量是不够的,cmd右键“以管理员的身份运行”


image.png
C:\Windows\system32>python -V
Python 3.6.5
  1. 安装dango2.0
    python3自带pip
C:\Windows\system32>pip -V
pip 9.0.3 from d:\work\software\python3.6\lib\site-packages (python 3.6)

使用pin安装Django

C:\Windows\system32>pip install Django
Collecting Django
  Downloading https://files.pythonhosted.org/packages/ab/15/cfde97943f0db45e4f999c60b696fbb4df59e82bbccc686770f4e44c9094/Django-2.0.7-py3-none-any.whl (7.1MB)
    100% |████████████████████████████████| 7.1MB 22kB/s
Collecting pytz (from Django)
  Downloading https://files.pythonhosted.org/packages/30/4e/27c34b62430286c6d59177a0842ed90dc789ce5d1ed740887653b898779a/pytz-2018.5-py2.py3-none-any.whl (510kB)
    100% |████████████████████████████████| 512kB 17kB/s
Installing collected packages: pytz, Django
Successfully installed Django-2.0.7 pytz-2018.5
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

检查是否安装成功

C:\Windows\system32>python
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.get_version()
'2.0.7'
>>>

参考资料:http://www.runoob.com/django/django-install.html

D:\work\workplace>django-admin.py startproject HelloDjango

D:\work\workplace>

自动创建了一个Django项目:


image.png
D:\work\workplace\HelloDjango>python manage.py runserver 0.0.0.0:8000
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.
July 06, 2018 - 00:03:45
Django version 2.0.7, using settings 'HelloDjango.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CTRL-BREAK.
image.png
[06/Jul/2018 00:02:50] "GET / HTTP/1.1" 200 16348
[06/Jul/2018 00:02:51] "GET /static/admin/css/fonts.css HTTP/1.1" 200 423
[06/Jul/2018 00:02:51] "GET /static/admin/fonts/Roboto-Bold-webfont.woff HTTP/1.1" 200 82564
[06/Jul/2018 00:02:51] "GET /static/admin/fonts/Roboto-Regular-webfont.woff HTTP/1.1" 200 80304
[06/Jul/2018 00:02:51] "GET /static/admin/fonts/Roboto-Light-webfont.woff HTTP/1.1" 200 81348

你可能感兴趣的:(windows python3.7+Django2.0)