欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ubuntu16.04Django环境的搭建

程序员文章站 2022-05-09 22:50:20
...

先安装虚拟环境,再装Django
1.sudo apt-get install virtualenv 首先安装virtualenv这个包
2.sudo apt-get install virtualenvwrapper 然后我们在安装virtualenwrapper这个包
3.在当前的命令窗口中输入
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
运行下virtualenvwrapper.sh
4.mkvirtualenv python1805Django -p /usr/bin/python3
新开一个终端,先mkvirtualenv「虚拟环境名字」
查看是否创建成功
其中python1805Django是虚拟环境名字
/usr/bin/python3是python3的路径
可以通过whereis python3来获得
5.workon 项目名字 运行虚拟环境
6.pip install django==1.11.7 装Django
7.cd .virtualenvs/python1805Django/bin/ 查看Django是否安装成功
8.新建一个目录 为这个虚拟环境建一个工作环境 然后转目录到这个文件夹中
输入django-admin startproject day01
day01 为项目名字
9.tree 可以看到
.
└── day01
├── day01
│ ├── init.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
└── manage.py

10.转到day01中 输入
python manage.py runserver
11.python manage.py startapp [app名字]
tree 可以看到
.
├── App
│ ├── admin.py
│ ├── apps.py
│ ├── init.py
│ ├── migrations
│ │ └── init.py
│ ├── models.py
│ ├── tests.py
│ └── views.py
├── day01
│ ├── init.py
│ ├── pycache
│ │ ├── init.cpython-35.pyc
│ │ ├── settings.cpython-35.pyc
│ │ ├── urls.cpython-35.pyc
│ │ └── wsgi.cpython-35.pyc
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
├── db.sqlite3
└── manage.py
下面是博主安装时的步骤命令

[email protected]:~$ sudo apt-get install virtualenv
[sudo] zaq 的密码: 
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会同时安装下列软件:
  python3-virtualenv
下列【新】软件包将被安装:
  python3-virtualenv virtualenv
升级了 0 个软件包,新安装了 2 个软件包,要卸载 0 个软件包,有 314 个软件包未被升级。
需要下载 47.6 kB 的归档。
解压缩后会消耗 171 kB 的额外空间。
您希望继续执行吗? [Y/n] Y
获取:1 http://mirrors.aliyun.com/ubuntu xenial-updates/universe amd64 python3-virtualenv all 15.0.1+ds-3ubuntu1 [43.2 kB]
获取:2 http://mirrors.aliyun.com/ubuntu xenial-updates/universe amd64 virtualenv all 15.0.1+ds-3ubuntu1 [4,342 B]
已下载 47.6 kB,耗时 0秒 (468 kB/s)   
正在选中未选择的软件包 python3-virtualenv。
(正在读取数据库 ... 系统当前共安装有 181556 个文件和目录。)
正准备解包 .../python3-virtualenv_15.0.1+ds-3ubuntu1_all.deb  ...
正在解包 python3-virtualenv (15.0.1+ds-3ubuntu1) ...
正在选中未选择的软件包 virtualenv。
正准备解包 .../virtualenv_15.0.1+ds-3ubuntu1_all.deb  ...
正在解包 virtualenv (15.0.1+ds-3ubuntu1) ...
正在处理用于 man-db (2.7.5-1) 的触发器 ...
正在设置 python3-virtualenv (15.0.1+ds-3ubuntu1) ...
正在设置 virtualenv (15.0.1+ds-3ubuntu1) ...


[email protected]:~$ sudo apt-get install virtualenvwrapper
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会同时安装下列软件:
  javascript-common libjs-jquery libjs-sphinxdoc libjs-underscore python-pbr
  python-pkg-resources python-six python-stevedore python-virtualenv
  virtualenv-clone
建议安装:
  apache2 | lighttpd | httpd python-setuptools
下列【新】软件包将被安装:
  javascript-common libjs-jquery libjs-sphinxdoc libjs-underscore python-pbr
  python-pkg-resources python-six python-stevedore python-virtualenv
  virtualenv-clone virtualenvwrapper
升级了 0 个软件包,新安装了 11 个软件包,要卸载 0 个软件包,有 314 个软件包未被升级。
需要下载 594 kB 的归档。
解压缩后会消耗 2,692 kB 的额外空间。
您希望继续执行吗? [Y/n] Y
获取:1 http://mirrors.aliyun.com/ubuntu xenial/main amd64 javascript-common all 11 [6,066 B]
获取:2 http://mirrors.aliyun.com/ubuntu xenial/main amd64 libjs-jquery all 1.11.3+dfsg-4 [161 kB]
获取:3 http://mirrors.aliyun.com/ubuntu xenial/main amd64 libjs-underscore all 1.7.0~dfsg-1ubuntu1 [46.7 kB]
获取:4 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 libjs-sphinxdoc all 1.3.6-2ubuntu1.2 [57.8 kB]
获取:5 http://mirrors.aliyun.com/ubuntu xenial/main amd64 python-pkg-resources all 20.7.0-1 [108 kB]
获取:6 http://mirrors.aliyun.com/ubuntu xenial/main amd64 python-six all 1.10.0-3 [10.9 kB]
获取:7 http://mirrors.aliyun.com/ubuntu xenial/main amd64 python-pbr all 1.8.0-4ubuntu1 [46.6 kB]
获取:8 http://mirrors.aliyun.com/ubuntu xenial/main amd64 python-stevedore all 1.12.0-1 [17.7 kB]
获取:9 http://mirrors.aliyun.com/ubuntu xenial-updates/universe amd64 python-virtualenv all 15.0.1+ds-3ubuntu1 [46.6 kB]
获取:10 http://mirrors.aliyun.com/ubuntu xenial/universe amd64 virtualenv-clone all 0.2.5-1 [7,428 B]
获取:11 http://mirrors.aliyun.com/ubuntu xenial/universe amd64 virtualenvwrapper all 4.3.1-2 [84.5 kB]
已下载 594 kB,耗时 1秒 (591 kB/s)       
正在选中未选择的软件包 javascript-common。
(正在读取数据库 ... 系统当前共安装有 181571 个文件和目录。)
正准备解包 .../javascript-common_11_all.deb  ...
正在解包 javascript-common (11) ...
正在选中未选择的软件包 libjs-jquery。
正准备解包 .../libjs-jquery_1.11.3+dfsg-4_all.deb  ...
正在解包 libjs-jquery (1.11.3+dfsg-4) ...
正在选中未选择的软件包 libjs-underscore。
正准备解包 .../libjs-underscore_1.7.0~dfsg-1ubuntu1_all.deb  ...
正在解包 libjs-underscore (1.7.0~dfsg-1ubuntu1) ...
正在选中未选择的软件包 libjs-sphinxdoc。
正准备解包 .../libjs-sphinxdoc_1.3.6-2ubuntu1.2_all.deb  ...
正在解包 libjs-sphinxdoc (1.3.6-2ubuntu1.2) ...
正在选中未选择的软件包 python-pkg-resources。
正准备解包 .../python-pkg-resources_20.7.0-1_all.deb  ...
正在解包 python-pkg-resources (20.7.0-1) ...
正在选中未选择的软件包 python-six。
正准备解包 .../python-six_1.10.0-3_all.deb  ...
正在解包 python-six (1.10.0-3) ...
正在选中未选择的软件包 python-pbr。
正准备解包 .../python-pbr_1.8.0-4ubuntu1_all.deb  ...
正在解包 python-pbr (1.8.0-4ubuntu1) ...
正在选中未选择的软件包 python-stevedore。
正准备解包 .../python-stevedore_1.12.0-1_all.deb  ...
正在解包 python-stevedore (1.12.0-1) ...
正在选中未选择的软件包 python-virtualenv。
正准备解包 .../python-virtualenv_15.0.1+ds-3ubuntu1_all.deb  ...
正在解包 python-virtualenv (15.0.1+ds-3ubuntu1) ...
正在选中未选择的软件包 virtualenv-clone。
正准备解包 .../virtualenv-clone_0.2.5-1_all.deb  ...
正在解包 virtualenv-clone (0.2.5-1) ...
正在选中未选择的软件包 virtualenvwrapper。
正准备解包 .../virtualenvwrapper_4.3.1-2_all.deb  ...
正在解包 virtualenvwrapper (4.3.1-2) ...
正在处理用于 man-db (2.7.5-1) 的触发器 ...
正在处理用于 doc-base (0.10.7) 的触发器 ...
Processing 1 added doc-base file...
正在设置 javascript-common (11) ...
正在设置 libjs-jquery (1.11.3+dfsg-4) ...
正在设置 libjs-underscore (1.7.0~dfsg-1ubuntu1) ...
正在设置 libjs-sphinxdoc (1.3.6-2ubuntu1.2) ...
正在设置 python-pkg-resources (20.7.0-1) ...
正在设置 python-six (1.10.0-3) ...
正在设置 python-pbr (1.8.0-4ubuntu1) ...
update-alternatives: 使用 /usr/bin/python2-pbr 来在自动模式中提供 /usr/bin/pbr (pbr)
正在设置 python-stevedore (1.12.0-1) ...
正在设置 python-virtualenv (15.0.1+ds-3ubuntu1) ...
正在设置 virtualenv-clone (0.2.5-1) ...
正在设置 virtualenvwrapper (4.3.1-2) ...


[email protected]:~$ source /usr/share/virtualenvwrapper/virtualenvwrapper.sh


[email protected]:~$ ll
总用量 184
drwxr-xr-x 26 zaq  zaq  4096 910 15:49 ./
drwxr-xr-x  5 root root 4096 830 09:57 ../
-rw-------  1 zaq  zaq  6754 910 15:55 .bash_history
-rw-r--r--  1 zaq  zaq   220 828 18:16 .bash_logout
-rw-r--r--  1 zaq  zaq  3771 828 18:16 .bashrc
drwx------ 20 zaq  zaq  4096 94 14:45 .cache/
drwx------  3 zaq  zaq  4096 830 21:28 .compiz/
drwx------ 29 zaq  zaq  4096 910 15:56 .config/
-rw-rw-r--  1 zaq  zaq   199 830 15:10 date.txt
-rw-------  1 zaq  zaq  1944 96 10:10 .dbshell
drwx------  3 zaq  zaq  4096 828 19:30 .dbus/
-rw-r--r--  1 zaq  zaq    25 828 19:30 .dmrc
-rw-r--r--  1 zaq  zaq  8980 828 18:16 examples.desktop
drwx------  2 zaq  zaq  4096 98 10:15 .gconf/
drwx------  3 zaq  zaq  4096 98 10:15 .gnupg/
-rw-------  1 zaq  zaq  5550 98 10:15 .ICEauthority
drwxrwxr-x  4 zaq  zaq  4096 93 19:31 .java/
drwx------  3 zaq  zaq  4096 828 19:30 .local/
-rw-------  1 zaq  zaq     0 94 20:00 .mongorc.js
drwx------  5 zaq  zaq  4096 830 14:25 .mozilla/
-rw-------  1 zaq  zaq  2566 98 09:34 .mysql_history
drwxrwxr-x  5 zaq  zaq  4096 98 09:33 .navicat64/
drwx------  2 zaq  zaq  4096 828 19:30 .presage/
-rw-r--r--  1 zaq  zaq   655 828 18:16 .profile
lrwxrwxrwx  1 root root   55 93 20:20 pycharm -> /下载/pycharm-2018.2.2/bin/pycharm.sh/usr/bin/pycharm
drwxrwxr-x  4 zaq  zaq  4096 93 19:31 .PyCharm2018.2/
drwxrwxr-x  5 zaq  zaq  4096 94 18:00 PycharmProjects/
-rw-------  1 zaq  zaq   276 829 11:14 .python_history
-rw-rw-r--  1 zaq  zaq  1353 96 15:42 .rediscli_history
drwxrwxr-x  2 zaq  zaq  4096 97 11:22 .sogouinput/
-rw-r--r--  1 zaq  zaq     0 828 20:01 .sudo_as_admin_successful
drwx------  2 zaq  zaq  4096 829 09:04 .sunpinyin/
drwxrwxr-x  2 zaq  zaq  4096 910 15:54 .virtualenvs/
-rw-------  1 zaq  zaq    64 98 10:15 .Xauthority
-rw-rw-r--  1 zaq  zaq   132 828 22:58 .xinputrc
-rw-------  1 zaq  zaq    84 98 10:15 .xsession-errors
-rw-------  1 zaq  zaq    84 98 09:37 .xsession-errors.old
drwxr-xr-x  2 zaq  zaq  4096 828 19:30 公共的/
drwxr-xr-x  2 zaq  zaq  4096 828 19:30 模板/
drwxr-xr-x  2 zaq  zaq  4096 828 19:30 视频/
drwxr-xr-x  2 zaq  zaq  4096 828 19:30 图片/
drwxr-xr-x  5 zaq  zaq  4096 831 15:33 文档/
drwxr-xr-x  3 zaq  zaq  4096 93 19:28 下载/
drwxr-xr-x  2 zaq  zaq  4096 828 19:30 音乐/
drwxr-xr-x  5 zaq  zaq  4096 98 10:44 桌面/


[email protected]:~$ mkvirtualenv python1805Django -p /usr/bin/python3
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/zaq/.virtualenvs/python1805Django/bin/python3
Also creating executable in /home/zaq/.virtualenvs/python1805Django/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
(python1805Django) [email protected]:~$ workon
python1805Django
(python1805Django) [email protected]:~$ workon python1805Django
(python1805Django) [email protected]:~$ pip install django==1.11.7
Collecting django==1.11.7
  Downloading https://files.pythonhosted.org/packages/15/d8/b17afdcd527026d2f1acd30ac33406e6b22c0f573a3c14b2d9e0bd7df945/Django-1.11.7-py2.py3-none-any.whl (6.9MB)
    100% |████████████████████████████████| 7.0MB 548kB/s 
Collecting pytz (from django==1.11.7)
  Downloading https://files.pythonhosted.org/packages/30/4e/27c34b62430286c6d59177a0842ed90dc789ce5d1ed740887653b898779a/pytz-2018.5-py2.py3-none-any.whl (510kB)
    100% |████████████████████████████████| 512kB 667kB/s 
Installing collected packages: pytz, django
Successfully installed django-1.11.7 pytz-2018.5
(python1805Django) [email protected]:~$ ll
总用量 184
drwxr-xr-x 26 zaq  zaq  4096 910 15:49 ./
drwxr-xr-x  5 root root 4096 830 09:57 ../
-rw-------  1 zaq  zaq  6786 910 16:04 .bash_history
-rw-r--r--  1 zaq  zaq   220 828 18:16 .bash_logout
-rw-r--r--  1 zaq  zaq  3771 828 18:16 .bashrc
drwx------ 20 zaq  zaq  4096 94 14:45 .cache/
drwx------  3 zaq  zaq  4096 830 21:28 .compiz/
drwx------ 29 zaq  zaq  4096 910 17:13 .config/
-rw-rw-r--  1 zaq  zaq   199 830 15:10 date.txt
-rw-------  1 zaq  zaq  1944 96 10:10 .dbshell
drwx------  3 zaq  zaq  4096 828 19:30 .dbus/
-rw-r--r--  1 zaq  zaq    25 828 19:30 .dmrc
-rw-r--r--  1 zaq  zaq  8980 828 18:16 examples.desktop
drwx------  2 zaq  zaq  4096 98 10:15 .gconf/
drwx------  3 zaq  zaq  4096 98 10:15 .gnupg/
-rw-------  1 zaq  zaq  5550 98 10:15 .ICEauthority
drwxrwxr-x  4 zaq  zaq  4096 93 19:31 .java/
drwx------  3 zaq  zaq  4096 828 19:30 .local/
-rw-------  1 zaq  zaq     0 94 20:00 .mongorc.js
drwx------  5 zaq  zaq  4096 830 14:25 .mozilla/
-rw-------  1 zaq  zaq  2566 98 09:34 .mysql_history
drwxrwxr-x  5 zaq  zaq  4096 98 09:33 .navicat64/
drwx------  2 zaq  zaq  4096 828 19:30 .presage/
-rw-r--r--  1 zaq  zaq   655 828 18:16 .profile
lrwxrwxrwx  1 root root   55 93 20:20 pycharm -> /下载/pycharm-2018.2.2/bin/pycharm.sh/usr/bin/pycharm
drwxrwxr-x  4 zaq  zaq  4096 93 19:31 .PyCharm2018.2/
drwxrwxr-x  5 zaq  zaq  4096 94 18:00 PycharmProjects/
-rw-------  1 zaq  zaq   276 829 11:14 .python_history
-rw-rw-r--  1 zaq  zaq  1353 96 15:42 .rediscli_history
drwxrwxr-x  2 zaq  zaq  4096 97 11:22 .sogouinput/
-rw-r--r--  1 zaq  zaq     0 828 20:01 .sudo_as_admin_successful
drwx------  2 zaq  zaq  4096 829 09:04 .sunpinyin/
drwxrwxr-x  3 zaq  zaq  4096 910 18:16 .virtualenvs/
-rw-------  1 zaq  zaq    64 98 10:15 .Xauthority
-rw-rw-r--  1 zaq  zaq   132 828 22:58 .xinputrc
-rw-------  1 zaq  zaq    84 98 10:15 .xsession-errors
-rw-------  1 zaq  zaq    84 98 09:37 .xsession-errors.old
drwxr-xr-x  2 zaq  zaq  4096 828 19:30 公共的/
drwxr-xr-x  2 zaq  zaq  4096 828 19:30 模板/
drwxr-xr-x  2 zaq  zaq  4096 828 19:30 视频/
drwxr-xr-x  2 zaq  zaq  4096 828 19:30 图片/
drwxr-xr-x  5 zaq  zaq  4096 831 15:33 文档/
drwxr-xr-x  3 zaq  zaq  4096 93 19:28 下载/
drwxr-xr-x  2 zaq  zaq  4096 828 19:30 音乐/
drwxr-xr-x  5 zaq  zaq  4096 98 10:44 桌面/
(python1805Django) [email protected]:~$ cd .virtualenvs/
(python1805Django) [email protected]:~/.virtualenvs$ ll
总用量 60
drwxrwxr-x  3 zaq zaq 4096 910 18:16 ./
drwxr-xr-x 26 zaq zaq 4096 910 15:49 ../
-rwxr-xr-x  1 zaq zaq  135 910 15:49 get_env_details*
-rw-r--r--  1 zaq zaq   96 910 15:49 initialize
-rw-r--r--  1 zaq zaq   73 910 15:49 postactivate
-rw-r--r--  1 zaq zaq   75 910 15:49 postdeactivate
-rwxr-xr-x  1 zaq zaq   66 910 15:49 postmkproject*
-rw-r--r--  1 zaq zaq   73 910 15:49 postmkvirtualenv
-rwxr-xr-x  1 zaq zaq  110 910 15:49 postrmvirtualenv*
-rwxr-xr-x  1 zaq zaq   99 910 15:49 preactivate*
-rw-r--r--  1 zaq zaq   76 910 15:49 predeactivate
-rwxr-xr-x  1 zaq zaq   91 910 15:49 premkproject*
-rwxr-xr-x  1 zaq zaq  130 910 15:49 premkvirtualenv*
-rwxr-xr-x  1 zaq zaq  111 910 15:49 prermvirtualenv*
drwxrwxr-x  6 zaq zaq 4096 910 18:16 python1805Django/

(python1805Django) [email protected]:~/.virtualenvs$ cd python1805Django/

(python1805Django) [email protected]:~/.virtualenvs/python1805Django$ ll
总用量 28
drwxrwxr-x 6 zaq zaq 4096 910 18:16 ./
drwxrwxr-x 3 zaq zaq 4096 910 18:16 ../
drwxrwxr-x 3 zaq zaq 4096 910 18:17 bin/
drwxrwxr-x 2 zaq zaq 4096 910 18:16 include/
drwxrwxr-x 3 zaq zaq 4096 910 18:16 lib/
-rw-rw-r-- 1 zaq zaq   59 910 18:16 pip-selfcheck.json
drwxrwxr-x 3 zaq zaq 4096 910 18:16 share/
(python1805Django) [email protected]:~/.virtualenvs/python1805Django$ cd bin/
(python1805Django) [email protected]:~/.virtualenvs/python1805Django/bin$ ll
总用量 4444
drwxrwxr-x 3 zaq zaq    4096 910 18:17 ./
drwxrwxr-x 6 zaq zaq    4096 910 18:16 ../
-rw-rw-r-- 1 zaq zaq    2098 910 18:16 activate
-rw-rw-r-- 1 zaq zaq    1040 910 18:16 activate.csh
-rw-rw-r-- 1 zaq zaq    2238 910 18:16 activate.fish
-rw-rw-r-- 1 zaq zaq    1137 910 18:16 activate_this.py
-rwxrwxr-x 1 zaq zaq     302 910 18:17 django-admin*
-rwxrwxr-x 1 zaq zaq     160 910 18:17 django-admin.py*
-rwxrwxr-x 1 zaq zaq     268 910 18:16 easy_install*
-rwxrwxr-x 1 zaq zaq     268 910 18:16 easy_install-3.5*
-rwxr-xr-x 1 zaq zaq     150 910 18:16 get_env_details*
-rwxrwxr-x 1 zaq zaq     250 910 18:16 pip*
-rwxrwxr-x 1 zaq zaq     250 910 18:16 pip3*
-rwxrwxr-x 1 zaq zaq     250 910 18:16 pip3.5*
-rw-r--r-- 1 zaq zaq      72 910 18:16 postactivate
-rw-r--r-- 1 zaq zaq      74 910 18:16 postdeactivate
-rwxr-xr-x 1 zaq zaq      69 910 18:16 preactivate*
-rw-r--r-- 1 zaq zaq      75 910 18:16 predeactivate
drwxrwxr-x 2 zaq zaq    4096 910 18:17 __pycache__/
lrwxrwxrwx 1 zaq zaq       7 910 18:16 python -> python3*
-rwxrwxr-x 1 zaq zaq 4464400 910 18:16 python3*
lrwxrwxrwx 1 zaq zaq       7 910 18:16 python3.5 -> python3*
-rwxrwxr-x 1 zaq zaq    2357 910 18:16 python-config*
-rwxrwxr-x 1 zaq zaq     247 910 18:16 wheel*

(python1805Django) [email protected]:~/.virtualenvs/python1805Django/bin$ cd ..
(python1805Django) [email protected]:~/.virtualenvs/python1805Django$ cd ..
(python1805Django) [email protected]:~/.virtualenvs$ cd ..
(python1805Django) [email protected]:~$ ll
总用量 184
drwxr-xr-x 26 zaq  zaq  4096 910 15:49 ./
drwxr-xr-x  5 root root 4096 830 09:57 ../
-rw-------  1 zaq  zaq  6786 910 16:04 .bash_history
-rw-r--r--  1 zaq  zaq   220 828 18:16 .bash_logout
-rw-r--r--  1 zaq  zaq  3771 828 18:16 .bashrc
drwx------ 20 zaq  zaq  4096 94 14:45 .cache/
drwx------  3 zaq  zaq  4096 830 21:28 .compiz/
drwx------ 29 zaq  zaq  4096 910 17:13 .config/
-rw-rw-r--  1 zaq  zaq   199 830 15:10 date.txt
-rw-------  1 zaq  zaq  1944 96 10:10 .dbshell
drwx------  3 zaq  zaq  4096 828 19:30 .dbus/
-rw-r--r--  1 zaq  zaq    25 828 19:30 .dmrc
-rw-r--r--  1 zaq  zaq  8980 828 18:16 examples.desktop
drwx------  2 zaq  zaq  4096 98 10:15 .gconf/
drwx------  3 zaq  zaq  4096 98 10:15 .gnupg/
-rw-------  1 zaq  zaq  5550 98 10:15 .ICEauthority
drwxrwxr-x  4 zaq  zaq  4096 93 19:31 .java/
drwx------  3 zaq  zaq  4096 828 19:30 .local/
-rw-------  1 zaq  zaq     0 94 20:00 .mongorc.js
drwx------  5 zaq  zaq  4096 830 14:25 .mozilla/
-rw-------  1 zaq  zaq  2566 98 09:34 .mysql_history
drwxrwxr-x  5 zaq  zaq  4096 98 09:33 .navicat64/
drwx------  2 zaq  zaq  4096 828 19:30 .presage/
-rw-r--r--  1 zaq  zaq   655 828 18:16 .profile
lrwxrwxrwx  1 root root   55 93 20:20 pycharm -> /下载/pycharm-2018.2.2/bin/pycharm.sh/usr/bin/pycharm
drwxrwxr-x  4 zaq  zaq  4096 93 19:31 .PyCharm2018.2/
drwxrwxr-x  5 zaq  zaq  4096 94 18:00 PycharmProjects/
-rw-------  1 zaq  zaq   276 829 11:14 .python_history
-rw-rw-r--  1 zaq  zaq  1353 96 15:42 .rediscli_history
drwxrwxr-x  2 zaq  zaq  4096 97 11:22 .sogouinput/
-rw-r--r--  1 zaq  zaq     0 828 20:01 .sudo_as_admin_successful
drwx------  2 zaq  zaq  4096 829 09:04 .sunpinyin/
drwxrwxr-x  3 zaq  zaq  4096 910 18:16 .virtualenvs/
-rw-------  1 zaq  zaq    64 98 10:15 .Xauthority
-rw-rw-r--  1 zaq  zaq   132 828 22:58 .xinputrc
-rw-------  1 zaq  zaq    84 98 10:15 .xsession-errors
-rw-------  1 zaq  zaq    84 98 09:37 .xsession-errors.old
drwxr-xr-x  2 zaq  zaq  4096 828 19:30 公共的/
drwxr-xr-x  2 zaq  zaq  4096 828 19:30 模板/
drwxr-xr-x  2 zaq  zaq  4096 828 19:30 视频/
drwxr-xr-x  2 zaq  zaq  4096 828 19:30 图片/
drwxr-xr-x  5 zaq  zaq  4096 831 15:33 文档/
drwxr-xr-x  3 zaq  zaq  4096 93 19:28 下载/
drwxr-xr-x  2 zaq  zaq  4096 828 19:30 音乐/
drwxr-xr-x  5 zaq  zaq  4096 98 10:44 桌面/

(python1805Django) [email protected]:~$ cd 桌面

(python1805Django) [email protected]:~/桌面$ mkdir pywork

(python1805Django) [email protected]:~/桌面$ ll
总用量 98432
drwxr-xr-x  6 zaq zaq      4096 910 19:37 ./
drwxr-xr-x 26 zaq zaq      4096 910 15:49 ../
drwxrwxrwx  3 zaq zaq      4096 829 12:15 linux基础/
drwxrwxrwx  3 zaq zaq      4096 94 17:21 mysqlday18/
drwxrwxr-x  4 zaq zaq      4096 93 19:10 navicat120_premium_cs_x64/
-rwxrw-rw-  1 zaq zaq 100457993 89 09:23 navicat120_premium_cs_x64.tar.gz*
drwxrwxr-x  2 zaq zaq      4096 910 19:37 pywork/
-rwxrw-rw-  1 zaq zaq    307405 97 09:07 考试题目.docx*

(python1805Django) [email protected]:~/桌面$ cd pywork/
(python1805Django) [email protected]:~/桌面/pywork$ django-admin startproject day01

(python1805Django) [email protected]:~/桌面/pywork$ tree
.
└── day01
    ├── day01
    │   ├── __init__.py
    │   ├── settings.py
    │   ├── urls.py
    │   └── wsgi.py
    └── manage.py

2 directories, 5 files

(python1805Django) [email protected]:~/桌面/pywork$ cd day01/
(python1805Django) [email protected]:~/桌面/pywork/day01$ tree
.
├── day01
│   ├── __init__.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
└── manage.py

1 directory, 5 files
(python1805Django) [email protected]:~/桌面/pywork/day01$ python manager.py runserver
python: can't open file 'manager.py': [Errno 2] No such file or directory
(python1805Django) [email protected]:~/桌面/pywork/day01$ python manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).

You have 13 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.

September 10, 2018 - 11:44:04
Django version 1.11.7, using settings 'day01.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

^C(python1805Django) [email protected]:~/桌面/pywork/day01$ python manage.py startapp App

(python1805Django) [email protected]:~/桌面/pywork/day01$ tree
.
├── App
│   ├── admin.py
│   ├── apps.py
│   ├── __init__.py
│   ├── migrations
│   │   └── __init__.py
│   ├── models.py
│   ├── tests.py
│   └── views.py
├── day01
│   ├── __init__.py
│   ├── __pycache__
│   │   ├── __init__.cpython-35.pyc
│   │   ├── settings.cpython-35.pyc
│   │   ├── urls.cpython-35.pyc
│   │   └── wsgi.cpython-35.pyc
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── db.sqlite3
└── manage.py

4 directories, 17 files
相关标签: Django ubuntu16.04