django之安装和项目创建

dos界面下安装django

自动下载和安装:cmd:pip3 install  django

手动安装:

  1.登录django官网下载django

  2.下载地址:https://www.djangoproject.com/download/

  3.First, download Django-1.6.2.tar.gz (checksums). Then:

  4.下载完成后,解压压缩包到任意目录,到此解压的目录下打开windows命令行,运行命令:

      python setup.py install

1.输入python 

2.输入import django

3.输入django.get_version()     查看django安装版本

4.输入django                           查看django安装位置,默认安装在python3的安装目录下Python37\\lib\\site-packages\\django

 

dos下创建项目:

C:\Users\Administrator>django-admin startproject blog

创建成功的项目就在C:\Users\Administrator下

继续创建app:

C:\Users\Administrator>cd blog

C:\Users\Administrator\blog>python manage.py startapp app01

当前目录下就创建出所需的app01

启动django:

C:\Users\Administrator\blog>python manage.py runserver 127.1.1.1(IP):8080(PORT)

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.
May 17, 2018 - 09:34:36
Django version 2.0.5, using settings 'blog.settings'
Starting development server at http://127.1.1.1:8080/
Quit the server with CTRL-BREAK.

启动成功。。。。

如果想更换监听端口,重新执行runserver命令,更换相应端口便可

 

posted on 2018-05-17 09:01  小孩没穿鞋  阅读(149)  评论(0编辑  收藏  举报

导航