Heim  >  Artikel  >  Backend-Entwicklung  >  Django在Win7下的安装及创建项目hello word简明教程

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

WBOY
WBOYOriginal
2016-06-06 11:31:311185Durchsuche

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/

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn