I didn't do the Apache setup for this it was done by the hosting company and apparently they don't know that much about Python and mod_python, so I'm stuck I only have access to a .htaccess file and my own code.
.htaccess
AddHandler python-program .py
PythonHandler wsgiref.modpython_gateway::handler
PythonOption wsgi.application code::main
code.py
#!/usr/bin/python
import web
urls = (
'/(.*)', 'hello'
)
main = web.wsgifunc(web.webpyfunc(urls, globals()))
class hello:
def GET(self, name):
if not name:
name = 'Pussy'
return 'Hello, '+ name +'!'
#if __name__ == "__main__":
#main = web.wsgifunc(web.webpyfunc(urls, globals()))
Error message I'm seeing when loading the code.py file
MOD_PYTHON ERROR
ProcessId: 30954
Interpreter: 'example.dk'
ServerName: 'example.dk'
DocumentRoot: '/var/www/example.dk/web'
URI: '/code.py'
Location: None
Directory: '/var/www/example.dk/web/'
Filename: '/var/www/example.dk/web/code.py'
PathInfo: ''
Phase: 'PythonHandler'
Handler: 'wsgiref.modpython_gateway::handler'
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)
File "/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 1229, in _process_target
result = _execute_target(config, req, object, arg)
File "/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 1128, in _execute_target
result = object(arg)
File "/usr/lib/python2.7/wsgiref/modpython_gateway.py", line 206, in handler
app = getattr(module, objname)
AttributeError: 'module' object has no attribute 'main'
What am I missing? Im using http://webpy.org/deployment as a reference. Server environment
Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64
mainif it is in the main interpreter scope (if __name__ == "__main__":) but thecodemodule is being imported.