I wish to link my Python project to some
wsgi file. I'm using
I'd like my Python project to become situated in
I have set up Apache the following:
<VirtualHost *:80> ServerName www.example.me ServerAlias example.me ServerAdmin email@example.com DocumentRoot /usr/local/www/documents LogLevel warn Alias /robots.txt /usr/local/www/documents/robots.txt Alias /favicon.png /usr/local/www/documents/favicon.png Alias /media/ /usr/local/www/documents/media/ <Directory /usr/local/www/documents> Order allow,deny Allow from all </Directory> WSGIScriptAlias / /usr/local/www/wsgi-scripts/myApp.wsgi <Directory /usr/local/www/wsgi-scripts> Order allow,deny Allow from all </Directory> </VirtualHost>
To date this is exactly what I've in
import web urls = ( '/.*', 'hello', ) class hello: def GET(self): return "Hello, world" application = web.application(urls, globals()).wsgifunc()
What must i do to be able to link my project that is situated in
/var/www/myProject/start.py to become known as by
It appears you have start.py inside a different directory which you need to invoke from wsgi.py.
- Within this situation, you have to in some way tell wsgi.py to have the ability to import a module from the different folder. This thread has some particulars on that.
An easy method is to have wsgi file within the same folder because the start.py, and merely import and load the applying after that.. something similar to:
import start start.load_application()
Replace final argument to WSGIScriptAlias with '/var/www/myProject/start.py'.
Change reference in Directory directive to '/var/www/myProject'. Quite simply, just set the configuration to suggest towards the correct location to begin with.