I myself am a beginner Python developer, so I had the same questions. Perhaps a more advanced user can fill out the details. Here is what I have done so far:
- script (.py) cgi-bin. hosthost.com/cgi-bin/your_script.py. , .
, "" .py script, . , , WSGI. , Apache, WSGI:
LoadModule wsgi_module libexec/apache2/mod_wsgi.so
<VirtualHost *:80>
WSGIScriptAlias /myapp /Library/WebServer/wsgi-scripts/views.wsgi
<Directory /Library/WebServer/wsgi-scripts>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
views.wsgi - Python script. , localhost/myapp/-, views.wsgi. , .
:
def application(environ, start_response):
start_response('200 OK', [('content-type', 'text/html')])
return ['Hello world!']
environ , , , URLS , , , URL . - :
path = environ.get('PATH_INFO','')
if path.startswith('/helloworld'):
(, Django), , , HTML- , script. Django , (if, for ..), HTML. , , , .
, , , , - ...