windows下apache+wsgi+web.py环境搭建

简介:

首先安装好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

或者手动下载安装:

1.下载地址: http://webpy.org
2.解压到任意目录,进入目录python setup.py install,安装完毕后打开idle编辑器测试是否安装成功:

1
2
3
4
5
6
7
8
>>>  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
配置如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
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文件:

1
2
3
4
5
6
7
8
9
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, 配置完毕。


==============================================================================
本文转自被遗忘博客园博客,原文链接: http://www.cnblogs.com/rollenholt/archive/2012/08/09/2631068.html ,如需转载请自行联系原作者
相关文章
|
开发框架 监控 安全
Windows Defender 导致 Web IIS 服务异常停止排查
某日凌晨IIS服务异常停止,经查为Windows Defender安全补丁KB2267602触发引擎更新,导致系统资源波动,进而引发应用池回收。确认非人为操作,系统无重启。通过分析日志与监控,定位原因为Defender更新后扫描加重负载。解决方案:将IIS及.NET相关路径添加至Defender排除列表,避免业务影响。
1177 116
|
12月前
|
Java 测试技术 网络安全
Burp Suite Professional 2025.10 for Windows x64 - 领先的 Web 渗透测试软件
Burp Suite Professional 2025.10 for Windows x64 - 领先的 Web 渗透测试软件
593 0
Burp Suite Professional 2025.10 for Windows x64 - 领先的 Web 渗透测试软件
|
Java 开发工具
鸿蒙Flutter实战:02-Windows环境搭建踩坑指南
本指南介绍如何搭建鸿蒙Flutter开发环境,包括下载Flutter SDK、配置环境变量(如FLUTTER_STORAGE_BASE_URL、PUB_HOSTED_URL、DEVECO_SDK_HOME等)和检查工具版本。还提到避免项目路径过深、与SDK同盘存放等注意事项,以及解决VsCode无法识别设备的方法。
857 0
|
安全 Linux iOS开发
Burp Suite Professional 2025.7 (macOS, Linux, Windows) - Web 应用安全、测试和扫描
Burp Suite Professional 2025.7 (macOS, Linux, Windows) - Web 应用安全、测试和扫描
958 0
Burp Suite Professional 2025.7 (macOS, Linux, Windows) - Web 应用安全、测试和扫描
|
人工智能 安全 网络安全
Burp Suite Professional 2025.5 for Windows x64 - 领先的 Web 渗透测试软件
Burp Suite Professional 2025.5 for Windows x64 - 领先的 Web 渗透测试软件
745 4
Burp Suite Professional 2025.5 for Windows x64 - 领先的 Web 渗透测试软件
|
安全 Devops 测试技术
AppSpider 7.5.018 for Windows - Web 应用程序安全测试
AppSpider 7.5.018 for Windows - Web 应用程序安全测试
329 0
AppSpider 7.5.018 for Windows - Web 应用程序安全测试
|
人工智能 Linux iOS开发
Burp Suite Professional 2025.2 (macOS, Linux, Windows) - Web 应用安全、测试和扫描
Burp Suite Professional 2025.2 (macOS, Linux, Windows) - Web 应用安全、测试和扫描
1225 12
Burp Suite Professional 2025.2 (macOS, Linux, Windows) - Web 应用安全、测试和扫描
|
安全 JavaScript Java
AppSpider Pro 7.5.015 for Windows - Web 应用程序安全测试
AppSpider Pro 7.5.015 for Windows - Web 应用程序安全测试
347 12
AppSpider Pro 7.5.015 for Windows - Web 应用程序安全测试
|
自然语言处理 安全 测试技术
HCL AppScan Standard 10.8.0 (Windows) - Web 应用程序安全测试
HCL AppScan Standard 10.8.0 (Windows) - Web 应用程序安全测试
1146 0
HCL AppScan Standard 10.8.0 (Windows) - Web 应用程序安全测试
|
安全 网络协议 网络安全
Windows Server 2003 Web服务器搭建
Windows Server 2003 Web服务器搭建
375 1

热门文章

最新文章

推荐镜像

更多