django学之路01--环境安装和pycharm运行django项目

1. 环境安装python

1).virtualenv安装django

C:\Users\Administrator>pip install virtualenv
Collecting virtualenv
  Using cached https://files.pythonhosted.org/packages/b6/30/96a02b2287098b23b875bc8c2f58071c35d2efe84f747b64d523721dc2b5/virtualenv-16.0.0-py2.py3-none-any.whl
Installing collected packages: virtualenv
Successfully installed virtualenv-16.0.0

 

2). 创建虚拟环境app

D:\work\env>virtualenv django_env
New python executable in D:\work\env\django_env\Scripts\python.exe
Installing setuptools, pip, wheel...done.

 

3).进入虚拟环境并安装django函数

D:\work\env\django_env\Scripts>activate

(django_env) D:\work\env\django\Scripts>pip install django
Collecting django
  Using cached https://files.pythonhosted.org/packages/bf/e0/e659df5b5b82299fffd8b3df2910c99351b9308b8f45f5702cc4cdf946e9/Django-1.11.14-py2.py3-none-any.whl
Collecting pytz (from django)
  Using cached https://files.pythonhosted.org/packages/30/4e/27c34b62430286c6d59177a0842ed90dc789ce5d1ed740887653b898779a/pytz-2018.5-py2.py3-none-any.whl
Installing collected packages: pytz, django
Successfully installed django-1.11.14 pytz-2018.5

 

2. pycharm建立django项目单元测试

1)建立项目测试

 

2) 项目结构url

上面djangoProject:项目名称,可修改spa

apps:项目名称,若是分多个模块,一般放在该目录下3d

tests:应用下单元测试用例code

views:应用视图函数

下面djangoProject:项目实际的python,最好不要修改,涉及配置问题

settings:项目全局配置文件

urls:项目全局路由

wsgi:项目wsgi配置

template:配置模板文件

manage:程序入口

相关文章
相关标签/搜索