This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
mandaye-cam/server.py

37 lines
961 B
Python
Raw Permalink Normal View History

2013-05-23 11:09:39 +02:00
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Script to launch mandaye with gunicorn server
"""
import os
import sys
from gunicorn.app.wsgiapp import WSGIApplication
class MandayeWSGIApplication(WSGIApplication):
2013-05-23 11:09:39 +02:00
def init(self, parser, opts, args):
self.cfg.set("default_proc_name", "cam.wsgi:application_dev")
self.app_uri = "cam.wsgi:application_dev"
2013-05-23 11:09:39 +02:00
def main():
""" The ``gunicorn`` command line runner for launcing Gunicorn with
generic WSGI applications.
"""
config_file = None
config_arg_pos = None
for i, arg in enumerate(sys.argv[1:]):
if arg.startswith('--config='):
config_file = arg.split('=')[1]
config_arg_pos = i
if config_file:
os.environ['MANDAYE_CONFIG_FILES'] = config_file
if config_arg_pos is not None:
del sys.argv[config_arg_pos + 1]
MandayeWSGIApplication("%(prog)s [OPTIONS]").run()
2013-05-23 11:09:39 +02:00
if __name__ == "__main__":
main()