安装环境

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

相关文章:

  • 2021-08-04
  • 2021-12-02
  • 2021-07-20
  • 2022-12-23
  • 2021-08-31
  • 2021-09-10
  • 2022-12-23
  • 2021-03-30
猜你喜欢
  • 2021-12-24
  • 2021-05-05
  • 2021-10-11
  • 2021-08-23
  • 2021-04-23
  • 2021-10-26
相关资源
相似解决方案