I realize which i should use mod_wsgi to operate Python, and I've been looking to get that setup, but I am unclear about it:
This can be a sample configuration I discovered for web.py:
LoadModule wsgi_module modules/mod_wsgi.so WSGIScriptAlias /appname /var/www/webpy-app/code.py/ Alias /appname/static /var/www/webpy-app/static/ AddType text/html .py <Directory /var/www/webpy-app/> Order deny,allow Allow from all </Directory>
So... I realize I must configure my web server to suggest towards the python application? Is not there a method to utilize it like PHP, where, whenever you request a
.py file, Python translates it? How do i get my web server towards the very fundamental condition, where I'm able to upload personal files that contains
print "Hello World", request it, and also have it say "Hello World"?
I believe you should use mod_cgi with apache and make the Link to an accessible python file, using the first type of the script
this really is a really inefficient method of being able to access the python code because apache needs to reload python each time the page is utilized. Suitable for a 1-off maintenance script you alone call every occasionally, although not appropriate for active content utilized by customers.
Edit: I did not understand you had been on Home windows. Such like ought to be possible. Try searching
python apache cgi.
Edit: For those who have apache employed in cgi mode, you don't have to restart it each time. When the script exists and executable in the URL path trained with will run. Whether it is not then you will obtain a 404 page not found error
Edit: Used to do a really quick Search for 'python cgi' and located these 35mm slides from 10 years ago by Python's creator. They document an obsolete version from the languange however the 35mm slides from 41 let's start might be helpful for you. Like I only say, individuals have moved from scripting web programs that way but when your needs are pretty straight forward it'll still work. http://www.python.org/doc/essays/ppt/sd99east/index.htm
Edit: A great way is dependent on what you're attempting to do. Utilizing a framework that handles the serving for you personally might be helpful. I'm able to recommend Web2py as very capable, secure framework that will permit you to write scripts and add them dynamically. It features a home windows version which includes a simple web server, or configure apache too. As things are incorporated you may be ready to go in a few minutes should you browse the opening information. If you have not used web frameworks before and aren't acquainted with lanugage for example "model view controller" then don' be overwhelmed. http://www.web2py.com/
I do not think WSGI/mod_wsgi works with what for you to do-- a WSGI application generally gets control URL parsing, which causes it to be incompatible together with your "works like PHP" requirement.
If you won't want to use CGI, I believe mod_python's Writer is nearer to what you would like: http://www.modpython.org/live/current/doc-html/tut-pub.html