python安装django_Windows Python Django的安装和配置

Django下载地址:

Django 1.5.x 支持 Python 2.6.5 Python 2.7, Python 3.2 和 3.3.

Django 1.6.x 支持 Python 2.6.X, 2.7.X, 3.2.X 和 3.3.X

Django 1.7.x 支持 Python 2.7, 3.2, 3.3, 和 3.4 (注意:Python 2.6 不支持了)

Django 1.8.x 支持 Python 2.7, 3.2, 3.3, 3.4 和 3.5.  (长期支持版本 LTS)

Django 1.9.x 支持 Python 2.7, 3.4 和 3.5. 不支持 3.3 了

Django 1.10.x 支持 Python 2.7, 3.4 和 3.5.

Django 1.11.x 支持 Python 2.7, 3.4, 3.5 和 3.6(长期支持版本 LTS) 最后一个支持 Python 2.7 的版本

Django 2.0.x 支持 Python 3.4, 3.5 和 3.6 (注意,不再支持 Python 2)

我这里下载的是:Django-2.1.1.tar.gz

使用压缩工具解压至: D:\MyApps\Python\Django-2.1.1

检查Python是否安装好:C:\Users\admin>python -V

Python 3.4.4

CMD窗口中执行(python setup.py install):

(D:\MyApps\Python\Django-2.1.1\python setup.py install)D:\MyApps\Python\Django-2.1.1>python setup.py install

==========================

Unsupported Python version

==========================

This version of Django requires Python 3.5, but you're trying to

install it on Python 3.4.

This may be because you are using a version of pip that doesn't

understand the python_requires classifier. Make sure you

have pip >= 9.0 and setuptools >= 24.2, then try again:

$ python -m pip install --upgrade pip setuptools

$ python -m pip install django

This will install the latest version of Django which works on your

version of Python. If you can't upgrade your pip (or Python), request

an older version of Django:

$ python -m pip install "django<2"

Python版本太低,不支持。

切换成Python3.7:C:\Users\admin>python -V

Python 3.7.1rc1

CMD窗口中执行(python setup.py install):D:\MyApps\Python\Django-2.1.1>python setup.py install

......

Installed d:\myapps\python\python37\lib\site-packages\pytz-2018.5-py3.7.egg

Finished processing dependencies for Django==2.1.1

验证是否安装成功:D:\MyApps\Python\Django-2.1.1>python

Python 3.7.1rc1 (v3.7.1rc1:2064bcf6ce, Sep 26 2018, 15:15:36) [MSC v.1914 64 bit (AMD64)] on win32

Type "help", "copyright", "credits" or "license" for more information.

>>> import django

>>> django.VERSION

(2, 1, 1, 'final', 0)

>>> django.get_version()

'2.1.1'

>>>

安装完Django后,在Python根目录下的Scripts目录中:

(D:\MyApps\Python\Python37\Scripts)django-admin-script.py

django-admin.exe

easy_install-3.7.exe

easy_install.exe

pip.exe

pip3.7.exe

pip3.exe

将D:\MyApps\Python\Python37\Scripts目录配置到环境变量Path下。

运行"django-admin help",可以看到django的命令列表:C:\Users\admin> django-admin help

Type 'django-admin help ' for help on a specific subcommand.

Available subcommands:

[django]

check

compilemessages

createcachetable

dbshell

diffsettings

dumpdata

flush

inspectdb

loaddata

makemessages

makemigrations

migrate

runserver

sendtestemail

shell

showmigrations

sqlflush

sqlmigrate

sqlsequencereset

squashmigrations

startapp

startproject

test

testserver

Note that only Django core commands are listed as settings are not properly configured (error: Requested setting INSTALL

ED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call

settings.configure() before accessing settings.).

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值