I'm trying to run Bottle.py with Apache and mod_wsgi.
I'm running it on windows, using a xampp. python v2.7
My Apache config in httpd:
<VirtualHost *>
ServerName example.com
WSGIScriptAlias / C:\xampp\htdocs\GetXPathsProject\app.wsgi
<Directory C:\xampp\htdocs\GetXPathsProject>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
My app.wsgi code:
import os
os.chdir(os.path.dirname(__file__))
import bottle
application = bottle.default_app()
My hello.py:
from bottle import route
@route('/hello')
def hello():
return "Hello World!"
When I go to localhost/hello
I get a 404 error.
I don't have any other errors on the Apache log file, probably missing something basic.
There's no connecting point from your wsgi file to your hello.py file.
Put the content in your hello.py into the app.wsgi and restart your web server.
That should resolve the problem.
To make your application modular such that you can put the code into various files, check out Bottle's equivalent of Blueprints (used by Flask framework)