Add custom management command to start the application with tornado
This commit is contained in:
parent
a14f9b30ad
commit
3bfead298d
@ -78,7 +78,7 @@ KEY_LENGTH = 30
|
|||||||
_portable_db_path = object()
|
_portable_db_path = object()
|
||||||
|
|
||||||
|
|
||||||
def process_options(argv=None):
|
def process_options(argv=None, check_args=True):
|
||||||
if argv is None:
|
if argv is None:
|
||||||
argv = sys.argv[1:]
|
argv = sys.argv[1:]
|
||||||
|
|
||||||
@ -105,7 +105,11 @@ def process_options(argv=None):
|
|||||||
if opts.version:
|
if opts.version:
|
||||||
print get_version()
|
print get_version()
|
||||||
exit(0)
|
exit(0)
|
||||||
if args:
|
|
||||||
|
# Don't check for further args if we come from our custom management
|
||||||
|
# command, that always sets them
|
||||||
|
if args and not check_args:
|
||||||
|
|
||||||
sys.stderr.write("This command does not take arguments!\n\n")
|
sys.stderr.write("This command does not take arguments!\n\n")
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -113,8 +117,8 @@ def process_options(argv=None):
|
|||||||
return opts
|
return opts
|
||||||
|
|
||||||
|
|
||||||
def main(argv=None):
|
def main(argv=None, check_args=True):
|
||||||
opts = process_options(argv)
|
opts = process_options(argv, check_args)
|
||||||
_main(opts)
|
_main(opts)
|
||||||
|
|
||||||
|
|
||||||
|
0
openslides/utils/management/__init__.py
Normal file
0
openslides/utils/management/__init__.py
Normal file
0
openslides/utils/management/commands/__init__.py
Normal file
0
openslides/utils/management/commands/__init__.py
Normal file
23
openslides/utils/management/commands/run-tornado.py
Normal file
23
openslides/utils/management/commands/run-tornado.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
Start script for OpenSlides.
|
||||||
|
|
||||||
|
:copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
|
||||||
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
|
from openslides.main import main
|
||||||
|
|
||||||
|
|
||||||
|
class Command(BaseCommand):
|
||||||
|
'''
|
||||||
|
Start the application using the tornado webserver
|
||||||
|
'''
|
||||||
|
|
||||||
|
help = 'Start the application using the tornado webserver'
|
||||||
|
|
||||||
|
def handle(self, *args, **options):
|
||||||
|
main(check_args=False)
|
Loading…
Reference in New Issue
Block a user