Révision 9003c07e
Ajouté par Jérôme Schneider il y a plus de 9 ans
mandaye/skel/server.py | ||
---|---|---|
5 | 5 |
""" |
6 | 6 |
|
7 | 7 |
import os |
8 |
os.environ.setdefault("MANDAYE_CONFIG_MODULE", "{project_name}.config") |
|
9 |
|
|
10 | 8 |
import sys |
11 | 9 |
|
12 |
from mandaye.log import logger |
|
13 | 10 |
from gunicorn.app.wsgiapp import WSGIApplication |
14 | 11 |
|
15 | 12 |
class MandayeWSGIApplication(WSGIApplication): |
... | ... | |
22 | 19 |
""" The ``gunicorn`` command line runner for launcing Gunicorn with |
23 | 20 |
generic WSGI applications. |
24 | 21 |
""" |
25 |
logger.info('{project_name} reverse-proxy start') |
|
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] |
|
26 | 32 |
MandayeWSGIApplication("%(prog)s [OPTIONS]").run() |
27 | 33 |
|
28 | 34 |
if __name__ == "__main__": |
Formats disponibles : Unified diff
Centralized config.py into mandaye core
All the configuration is now in ini files.
You could have 3 levels of ini files : * default mandaye core ini file * default mandaye project ini file * optional ini file loading with --config option
Closes #5495