I'm following a simple tutorial on Setting up mod_wsgi on WampServer all runs fine until I try to Import, I tried searching the net, but didn't get a working solution, is this a bug issues (maybe not) or certainly a configuration issue?
How to Import a module in mod_wsgi?
setup: windows8 64 / wampserver x64 bit / mod_wsgi x64bit
Directory:
- Wampserver: c:/wamp
- wsgi app : c:/wamp/www/wsgi
- Python27 : c:/python27
Alias for wsgi app: {created as per in the tutorial via wamp's create an alias option}
WSGIScriptAlias /wsgi/ "c:/wamp/www/wsgi/wsgi.py"
<Directory "c:/wamp/www/wsgi/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
wsgi.py
from paste import httpserver
try :
p = sys.argv[1]
command = "from %(project)s import *" % {"project": p}
exec(command)
httpserver.serve(app, host='127.0.0.1', port='8080')
except :
print "Usage: python runner.py <main_package>"
sys.exit(0)
apache-error-log:
- Target WSGI script 'C:/wamp/www/wsgi/wsgi.py' cannot be loaded as Python module.
- Exception occurred processing WSGI script 'C:/wamp/www/wsgi/wsgi.py'.
- from paste import httpserver ImportError: cannot import name httpserver
However if I change the above code to:
def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'), ('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
It prints output.
options tried wsgi.py:
import os, sys
sys.path.append("c:\\wamp\\www\\wsgi\\paste\\")
sys.path.append(os.path.dirname(__file__))
sys.path.append('c:/wamp/www/wsgi/')
sys.path.insert(0, 'c:/wamp/www/wsgi')
sys.path.insert(1, 'c:/wamp/www')
sys.path.insert(0, "c:/wamp/www/wsgi/wsgi.py")
sys.path.insert(0, "c:/wamp/www/wsgi/paste")
Edit: paste module is in apps root directory.