I am a beginner programmer. I started using Python and Bottle for a small web application to print the form as well as it does. The real problem is setting up Apache and mod_wsgi
, since my knowledge is almost gone.
My problem . I keep getting this error:
Error 404: not found
Sorry, the requested URL / factura / caused an error: not found
In work, they gave me and redirected the address to IP: port; after several days of reading Apache documents and viewing examples over the Internet, I was able to configure so that my VirtualHost does not break other virtual hosts that are already running. The configuration looks like this (based on the deployment section of the bottle tutorial):
Listen port NameVirtualHost IP:port <VirtualHost IP:port> ServerName IP:port WSGIDaemonProcess factura processes=1 threads=5 WSGIScriptAlias / /var/www/factura/app.wsgi <Directory /var/www/factura> WSGIProcessGroup factura WSGIApplicationGroup %{GLOBAL} Order deny,allow Allow from all </Directory> </VirtualHost>
My app.wsgi
almost the same as in the "Deploying Bottle Tutorial" section. I added the line sys.stdout = sys.stderr
:
import sys, os, bottle
Here is some python code that is associated with Bottle:
from lib import bottle app = bottle.Bottle() #serves files in folder 'static' @app.route('/static/:path#.+#', name='static') def ... @app.route("/factura") @bottle.view("factura") def ... @app.route("/print_factura", method="POST") def ...
I read some other questions like this one, but I can't figure out what I am missing. I suppose the problem is in app.wsgi
?
UPDATE
file structure
/var/www/factura/
Apache error log only shows
Exception KeyError: KeyError(-1211426160,) in <module 'threading' from '/usr/lib/python2.6/threading.pyc'> ignored
is a warning against wsgi / python problems, harmless wsgi issue 197
UPDATE 2
added @app.route("/factura/")
notice the slash of the trail that with changing the import of the application from factura import app as application
these two made it work together