Home  >  Article  >  Backend Development  >  Django在Win7下的安装及创建项目hello word简明教程

Django在Win7下的安装及创建项目hello word简明教程

WBOY
WBOYOriginal
2016-06-06 11:31:311202browse

python广受欢迎的编程语言之一,本文简述了python 的django 框架安装与开发。

Django在Win7下的安装及创建项目hello word,相对而言非常简单,这里直接给出命令和代码,不懂的可以查阅相关资料。

1、安装:
命令如下:

pip install Django==1.6.5

2、创建项目

django-admin.py startproject web

修改 urls.py

url(r'^blog/index/$','blog.views.index'),

3、创建工程:

django-admin.py startapp blog

修改:/blog/views.py

添加:

from django.http import HttpResponse
def index(req):
  return HttpResponse("hello world");

4、启动自带的服务器

python manage.py runserver

访问页面:
http://127.0.0.1:8000/blog/index/

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn