windows下apache+wsgi+web.py环境搭建
2024-10-13 23:32:14
首先安装好wsgi模块并启用:
1.下载地址:我本机是python2.7 http://code.google.com/p/modwsgi/downloads/detail?name=mod_wsgi-win32-ap22py27-3.3.so
2.把mod_wsgi-win32-ap22py27-3.3.so放到apache安装目录下的modules目录下
3.打开 http.conf
添加:LoadModule wsgi_module modules/mod_wsgi-win32-ap22py27-3.3.so
下载安装web.py模块:
easy_install -U web.py
下载安装web.py模块:
easy_install -U web.py
或者手动下载安装:
1.下载地址: http://webpy.org
2.解压到任意目录,进入目录python setup.py install,安装完毕后打开idle编辑器测试是否安装成功:
>>> import web
>>> urls= ('/','index')
>>> app = web.application(urls,globals())
>>> class index:
def GET(self):
return 'hello world!' >>> app.run()
在浏览器中浏览127.0.0.1:8080,查看是否能正常显示
开始设置
比如我以后想把试用web.py的程序都放在d:\develop\webapp目录下,并且访问连接为:127.0.0.1/webapp
配置如下:
LoadModule wsgi_module modules/mod_wsgi.so WSGIScriptAlias /webapp "D:/develop/webapp/index.py/" Alias /webapp/static "D:/develop/webapp/static/"
AddType text/html .py <Directory "D:/develop/webapp/">
AllowOverride all
Options Indexes FollowSymLinks ExecCGI
Order allow,deny
SetHandler wsgi-script
Allow from all
</Directory>
重启apache。
测试是否成功:
编辑:d:/develop/webapp/index.py文件:
import web
urls = ('/','index') class index:
def GET(self):
return "hello world!" app = web.application(urls, globals(), autoreload=False)
application = app.wsgifunc()
访问http://localhost/webapp, 配置完毕。
最新文章
- Mybatis获取插入记录的自增长ID(转)
- 读书笔记_Effective_C++_条款四十八:了解模板元编程
- php中对2个数组相加的函数
- ubuntu下php5扩展mysqli
- (转)IOS开发之——绘图(CGContext)
- ovs 实用案例
- 25+免费的Bootstrap HTML5网站模板
- HTTP状态码作用
- 让 .NET 更方便的导入导出 Excel
- LazyMan深入解析和实现
- 在eclipse中启动项目报java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: PermGen space
- zeromq学习笔记1——centos下安装 zeromq-4.1.2
- 5.无监督学习-DBSCAN聚类算法及应用
- linker command failed with exit code 1 (use -v to see invocation) 变量重名
- python之web开发利器
- GoodUserInterface 模仿页面功能
- 用 Qt 中的 QDomDocument类 处理 XML 文件
- oracle_存储过程_没有参数_根据配置自动创建申请单以及写日志事务回滚
- [BZOJ4836]二元运算(分治FFT)
- 标准IO与文件IO 的区别
热门文章
- Zencart先生成订单后付款,类似淘宝后台修改订单价格
- 过程需要类型为 &#39;ntext/nchar/nvarchar&#39; 的参数 &#39;@statement&#39;
- codeforces 620F. Xors on Segments
- divmod数字处理函数
- 我被SQL注入撞了一下腰
- DataTabe对象的例子
- android中使用setVideoURI()播放视频
- MapList 自己封装的
- JAVA GUI学习 - JTable表格组件学习_A ***
- MaxSubArray 最大子数列和