Example #1
0
 def trier_uwsgi(self):
     import uwsgidecorators
     uwsgidecorators.thread(self.trier)()
Example #2
0
# application = HelloWorldApplication(application)

# from http://projects.unbit.it/uwsgi/wiki/TipsAndTricks
# AUTHOR: Simone Federici
try:
    # uwsgi module is only available when running from uwsgi
    import uwsgi
except ImportError:
    # we're probably running from django's built-in server
    pass
else:
    from uwsgidecorators import postfork, thread, timer
    from django.utils import autoreload

    # autodiscover SSH handlers
    import okupy.accounts.ssh  # noqa
    from okupy.common.ssh import ssh_main

    import Crypto.Random

    postfork(thread(ssh_main))

    @postfork
    def reset_rng():
        Crypto.Random.atfork()

    @timer(5)
    def change_code_gracefull_reload(sig):
        if autoreload.code_changed():
            uwsgi.reload()
Example #3
0
    def init_worker(self):
        self.queue = Queue(self.queue_size)

        from uwsgidecorators import postfork, thread
        self._post = postfork(thread(self._post))