move application export to isso.run

When using Gunicorn or uWSGI to run `isso.dispatch` it would
automatically initialize and a default Isso instance (and cause
several logging messages), although never used.

If you use uWSGI or Gunicorn, you have to change the module from
`isso` to `isso.run`.
This commit is contained in:
Martin Zimmermann 2013-12-08 19:15:06 +01:00
parent ebad039d0e
commit adc722359d
4 changed files with 10 additions and 6 deletions

View File

@ -36,7 +36,7 @@ supply everything as command-line arguments):
processes = 4
cache2 = name=hash,items=1024,blocksize=32
spooler = %d/mail
module = isso
module = isso.run
virtualenv = %d
env = ISSO_SETTINGS=%d/sample.cfg

View File

@ -184,4 +184,4 @@ To execute Isso, use a command similar to:
.. code-block:: sh
$ export ISSO_SETTINGS="/path/to/isso.cfg"
$ gunicorn -b localhost:8080 -w 4 --preload isso
$ gunicorn -b localhost:8080 -w 4 --preload isso.run

View File

@ -223,7 +223,3 @@ def main():
if ex.errno != errno.ENOENT:
raise
wsgi.SocketHTTPServer(sock, make_app(conf)).serve_forever()
if sys.argv[0].endswith(("uwsgi", "gunicorn")):
application = make_app(Config.load(os.environ.get('ISSO_SETTINGS')))

8
isso/run.py Normal file
View File

@ -0,0 +1,8 @@
# -*- encoding: utf-8 -*-
import os
from isso import make_app
from isso.core import Config
application = make_app(Config.load(os.environ.get('ISSO_SETTINGS')))