天天看点

python 学习1

安装环境

python(2.7.x)(64位) + django(1.9.7) + python-mysql(64位)

 安装python时自带pip与easy_install,因此可用 pip install django , pip install python-mysql

新建项目

django-admin.py startproject py_fir , py_fir为项目名

python manage.py runserver 8080, 在浏览器打开127.0.0.1:8080

python 学习1

再建一个应用app, python manage.py startapp blog

python 学习1

各个目录的作用详见 http://www.cnblogs.com/fengzheng/p/3819595.html

python 学习1

在 setting.py中的INSTALL_APPS中添加应用blog

python 学习1
python 学习1

urls.py:

python 学习1
python 学习1

views.py:

python 学习1

在blog目录下新建template/a.html

python 学习1

 python manage.py runserver 8080

在浏览器打开 http://localhost:8080/hello

python 学习1

引用了博客

http://www.cnblogs.com/fengzheng/p/3819595.html

上一篇: NodeJS学习
下一篇: ionic 初入门