Skip to content

Latest commit

 

History

History
92 lines (70 loc) · 1.59 KB

File metadata and controls

92 lines (70 loc) · 1.59 KB

Django环境

软件环境

  • CentOS 7.X
  • Python 3.X
  • Django 1.15
  • Docker
  • MySQL Server version: 5.5.52 MySQL Community Server

前置课程或背景知识

  • Linux 的基础知识
  • 常用的 Linux Shell 命令或脚本
  • Docker 的基础知识
  • Python 编程基础
    • Python的基础语法
    • Python 正则表达式
  • HTML JavaScript CSS 的基础
  • HTTP协议 基础知识
    • Request
    • Response
    • ContentType

目录结构

讲义的目录结构

~/working/django-leaning/ch01

~/working/django-leaning/ch02
~/working/django-leaning/ch02/ch02.md
~/working/django-leaning/ch02/mysite

~/working/django-leaning/ch03/ch03.md
~/working/django-leaning/ch03/mysite

...

启动Docker容器

docker rm pythonzero
docker run -m 2048m -it --name pythonzero -p 38000:8000 -v /Users/devuser/working:/usr/src/myapp -w /usr/src/myapp --link some-redis:redis --link some-mysql:mysql -w /usr/src/myapp python:latest /bin/bash

安装稳定版本的Django

pip install Django==1.11.5

后续我们要链接数据库 MySQL ,所以需要安装如下 package

pip install mysqlclient

获得最新版本的Django

git clone https://github.com/django/django.git

验证安装正常

# python
Python 3.6.2 (default, Sep 13 2017, 14:26:54)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> print( django.get_version())
1.11.5
>>>

快速验证版本

python -m django --version