diff --git a/openslides/main.py b/openslides/main.py index 945cce87b..aab5ac203 100644 --- a/openslides/main.py +++ b/openslides/main.py @@ -78,7 +78,7 @@ KEY_LENGTH = 30 _portable_db_path = object() -def process_options(argv=None): +def process_options(argv=None, check_args=True): if argv is None: argv = sys.argv[1:] @@ -105,7 +105,11 @@ def process_options(argv=None): if opts.version: print get_version() 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") parser.print_help() sys.exit(1) @@ -113,8 +117,8 @@ def process_options(argv=None): return opts -def main(argv=None): - opts = process_options(argv) +def main(argv=None, check_args=True): + opts = process_options(argv, check_args) _main(opts) diff --git a/openslides/utils/management/__init__.py b/openslides/utils/management/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/openslides/utils/management/commands/__init__.py b/openslides/utils/management/commands/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/openslides/utils/management/commands/run-tornado.py b/openslides/utils/management/commands/run-tornado.py new file mode 100644 index 000000000..39c5d6361 --- /dev/null +++ b/openslides/utils/management/commands/run-tornado.py @@ -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)