Replace PHP with Python with Apache
Basically I'm looking for a way to get rid of my PHP dependence, and I would like to switch to Python. I'm having trouble finding a way to basically make python a drop in replacement. I'm familiar with Django but its just not quick and dirty enough for most small things I have to do. So I'm wondering if there is an Apache module or a way to setup mod_wsgi to serve up *.p开发者_开发技巧y files the same way mod_php serves up *.php from the server root?
Note: I have found the various python extensions to php for calling code from PHP but that doesn't really solve the curly brace hell.
The files that mod_wsgi calls are Python files. Additionally, if you set them up in daemon mode, updating the python file will restart the daemon. It's pretty slick.
Another thing you could look at if Django is overkill is Werkzeug, which is pretty much just the server interface. Then later you can add database access with SqlAlchemy and/or templating with Jinja2. Or not.
These pieces are pretty much what people use when they want Django as pieces, and I'm told that they're more powerful, if more work to maintain (some assembly required).
Yes you can do that with mod_wsgi, but if you are new to developing Python web applications it is a potentially painful way to go about it. Either way, read the documentation at:
http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#The_Apache_Alias_Directive
You use AddHander just like you would with CGI or PHP scripts.
if you worked with php also you are familiar to mod_php
also there is mod_python ( http://www.modpython.org/ ) but its not active community ( there is many article how set django with mod_python ( http://docs.djangoproject.com/en/dev/howto/deployment/modpython/ ) )
but its better use wsgi and uwsgi
- http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/
- http://code.google.com/p/modwsgi/
精彩评论