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

WBOY
Release: 2016-06-06 11:31:31
Original
1201 people have browsed it

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

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

1、安装:
命令如下:

pip install Django==1.6.5
Copy after login

2、创建项目

django-admin.py startproject web

Copy after login

修改 urls.py

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

Copy after login

3、创建工程:

django-admin.py startapp blog

Copy after login

修改:/blog/views.py

添加:

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

Copy after login

4、启动自带的服务器

python manage.py runserver

Copy after login

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template