setting up wsgi like app engine
I have been using wsgi on app engine to great success and now i want to use a similar setup on a fedora core 8 machine. how do i go about doing it?
I am using yum and i have installed mod_wsgi but i don't know how to implement it. I have mod_python working a开发者_开发知识库lready
Thanks
WSGI is a specification, not a framework. Consider learning something a little less low-level, such as Flask or Django.
mod_wsgi configuration directives for httpd
Paste Deployment, a standalone WSGI container
WSGI tutorials if you insist on learning bare WSGI
Find the <VirtualHost>
section for the site you want in your Apache config and add:
WSGIScriptAlias /foo /path/to/your/app/foo.py
Now you've made a mapping between URL paths starting with /foo and the script foo.py. For mod_wsgi
, you just need to have that script leave a WSGI application callable under the name application
, eg:
def application(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/html;charset=utf-8')])
return ['<p>Hello world</p>']
and that's it. If you've already got a WSGI application object you should be able to drop it right in.
精彩评论