python之Django学习-01

python 3.6.3

Django 2.1.7

参考地址:地址

常用命令:

  • 创建项目:

    CD到你想放置代码的目录,运行一下命令:“novelWeb”为项目文件夹名称

django-admin startproject novelWeb
  • 运行项目:
python manage.py runserver

    显示如下:地址为http://127.0.0.1:8000/

Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

F:\python\novelWeb>python manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).

You have 15 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.
March 16, 2019 - 10:37:42
Django version 2.1.7, using settings 'novelWeb.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

  更换端口运行:

python manage.py runserver 8080

 

  修改服务器监听的ip:"0"为0.0.0.0简写

python manage.py runserver 0:8080
  • 创建模块目录:
python manage.py startapp polls

   目录结构如下:  

python之Django学习-01_第1张图片

 

你可能感兴趣的:(python,python,Django)