Django 之 "Hello Word"
2011-08-17 22:10
232 查看
简单页面
第一步:
创建Django Pydev项目 ,使用CMD进入项目目录 Src(下面) ,输入命令 Python manage.py runserver 开启服务, 类似于用IIS部署aspx页面
第二部
新建试图 views.py 文件
第三部 配置配置路由
在urls.py中
启动runserver默认使用8000端口,相应URL地址为 http://127.0.0.1:8000/Index/即可
接受url参数
修改路由
试图Action中接受参数
貌似Python Django 速度灰常的快, 貌似超过了asp.net
另外由于本人刚接触, ,比如此处我配置为Index,在地址中只能输入Http://xxx/Index,而 Http://xxx/index 就不行
希望高手指点下
第一步:
创建Django Pydev项目 ,使用CMD进入项目目录 Src(下面) ,输入命令 Python manage.py runserver 开启服务, 类似于用IIS部署aspx页面
第二部
新建试图 views.py 文件
from django.http import HttpResponse def Index(request): return HttpResponse("Hello Word")
第三部 配置配置路由
在urls.py中
urlpatterns = patterns('', (r'^Index/$',Index) )
启动runserver默认使用8000端口,相应URL地址为 http://127.0.0.1:8000/Index/即可
接受url参数
修改路由
urlpatterns = patterns('', (r'^Index/(\d+)/$',Index), )
试图Action中接受参数
def Index(request,id): html="<h1> Input id= %s </h1>" % int(id) return HttpResponse(html)
貌似Python Django 速度灰常的快, 貌似超过了asp.net
另外由于本人刚接触, ,比如此处我配置为Index,在地址中只能输入Http://xxx/Index,而 Http://xxx/index 就不行
希望高手指点下
相关文章推荐
- 1、简单程序 "hello,word"
- "><img src=hi onerror="confirm('厉害了word哥!!')">
- PacMan开发-Win32的"HelloWorld"&MyRegisterClass()函数
- JBoss6.0+EJB3中Message-DrivenBean的"HelloWorld"实现
- Word退出时(App.Quit())报错 "此文件正由另一个应用程序或用户使用"(原创)
- [LeetCode-Algorithms-139] "Word Break" (2017.12.14-WEEK15)
- 实现简单的"nginx+uwsgi+django"的服务器架构
- Spring的"Hello, world",还有"拿来主义"
- "hello world" 简单内核模块
- 把"Hello, World\n"转为机器码shellcode 来显示
- "Chrome浏览器下载Word、Excel、PPT,打开提示错误"问题
- EJB(二)图示EJB的"helloworld"
- 汇编语言的"hello world"
- QT的"hello word"
- Filter(1)-过滤器的"Helloworld"
- "No template named hello"
- EJB(二)图示EJB的"helloworld"
- django+Python的项目中出现 "detail": "CSRF Failed: CSRF cookie not set."
- Linux上的"Hello world"
- Java技术_Java千百问(0007)_为什么会报"错误: 找不到或无法加载主类 HelloWord.class"