Projet

Général

Profil

Télécharger (983 octets) Statistiques
| Branche: | Tag: | Révision:

root / mandaye / skel / server.py @ 9003c07e

1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3

    
4
""" Script to launch mandaye with gunicorn server
5
"""
6

    
7
import os
8
import sys
9

    
10
from gunicorn.app.wsgiapp import WSGIApplication
11

    
12
class MandayeWSGIApplication(WSGIApplication):
13

    
14
    def init(self, parser, opts, args):
15
        self.cfg.set("default_proc_name", "{project_name}.wsgi:application_dev")
16
        self.app_uri = "{project_name}.wsgi:application_dev"
17

    
18
def main():
19
    """ The ``gunicorn`` command line runner for launcing Gunicorn with
20
    generic WSGI applications.
21
    """
22
    config_file = None
23
    config_arg_pos = None
24
    for i, arg in enumerate(sys.argv[1:]):
25
        if arg.startswith('--config='):
26
            config_file = arg.split('=')[1]
27
            config_arg_pos = i
28
    if config_file:
29
        os.environ['MANDAYE_CONFIG_FILES'] = config_file
30
    if config_arg_pos is not None:
31
        del sys.argv[config_arg_pos + 1]
32
    MandayeWSGIApplication("%(prog)s [OPTIONS]").run()
33

    
34
if __name__ == "__main__":
35
    main()
36

    
(4-4/5)