WSGIScriptAlias /bottle /var/www/bottle-app/service.wsgi WSGIScriptReloading On <Directory /var/www/bottle-app> Order deny,allow Allow from all </Directory>
Flask
在 /var/www/flask-app 新建文件
myapp.py
1 2 3 4 5 6 7
from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" if __name__ == "__main__": app.run()
编写service.wsgi
1 2 3
import sys sys.path.insert(0, '/var/www/flask-app') from myapp import app as application
编辑Apache配置文件与bottle完全同理,此处略过
web.py
用pip2.7安装web.py,并做好相关配置。
在/var/www/webpy-app/目录新建文件
code.py
1 2 3 4 5 6 7 8
import web urls = ( '/.*', 'hello', ) class hello: def GET(self): return "Hello, world." application = web.application(urls, globals()).wsgifunc()
在Apache配置文件加入如下一段代码
1 2 3 4 5 6 7 8
LoadModule wsgi_module modules/mod_wsgi-py27.so WSGIScriptAlias /webpy /var/www/webpy-app/code.py/ Alias /webpy/static /var/www/webpy-app/static/ AddType text/html .py <Directory /var/www/webpy-app/> Order deny,allow Allow from all </Directory>