cubicweb/uwsgi/wsgiapp.py
author Arthur Lutz <arthur.lutz@logilab.fr>
Wed, 14 Dec 2016 15:12:19 +0100
changeset 102 6a34a4eb10ad
child 135 66dff7e6535d
permissions -rw-r--r--
[cubicweb/uwsgi] optionnal deploy of wsgi file (for looping tasks)

import os
from cubicweb.pyramid import wsgi_application_from_cwconfig
from cubicweb.cwconfig import CubicWebConfiguration as cwcfg

appid = os.environ['CW_INSTANCE']  # instance name

cwconfig = cwcfg.config_for(appid)

cwconfig.log_format = ('{0} pid:{1}'.format(appid, os.getpid()) +
                               ' (%(name)s) %(levelname)s: %(message)s')

application = wsgi_application_from_cwconfig(cwconfig,)
repo = application.application.registry['cubicweb.repository']
repo.start_looping_tasks()