Complex Python Bottle App + WSGI -
i have python bottle application inside of single folder that's been organized function , convert existing cherrypy usage on apache mod_wsgi.
the folder structure looks following:
- project -- app.py (loads webserver class , runs it) -- app --- common --- logs --- modules --- tools --- web ---- webserver.py
the reason structure code common used within tools , web without issue. imports done in style of "from app.common.blah import utility". when trying setup mod_wsgi, expects load simple application.
is possible run mod_wsgi folder structure this? if not, there recommendations setting structure allow mod_wsgi, sharing of common utilities between folders tools , web?
from bottle deployment docs on deployment:
all need app.wsgi file provides application object. object used mod_wsgi start application , should wsgi-compatible python callable.
file
/var/www/yourapp/app.wsgi
:
import os # change working directory relative paths (and template lookup) work again os.chdir(os.path.dirname(__file__)) import bottle # ... build or import bottle application here ... # not use bottle.run() mod_wsgi application = bottle.default_app()
in case, edit snippet above import application object presumably defined in app.py
Comments
Post a Comment