OpenSlides/server/openslides/core/management/commands/changeconfig.py
FinnStutzenstein 2bcab5d098
Repository restructure
- moved all server related things into the folder `server`, so this
configuration is parallel to the client.
- All main "services" are now folders in the root directory
- Added Dockerfiles to each service (currently server and client)
- Added a docker compose configuration to start everything together.
Currently there are heavy dependencies into https://github.com/OpenSlides/openslides-docker-compose
- Resturctured the .gitignore. If someone needs something excluded,
please add it to the right section.
- Added initial build setup with Docker and docker-compose.
- removed setup.py. We won't deliver OpenSlides via pip anymore.
2020-08-21 08:11:13 +02:00

34 lines
1.0 KiB
Python

from django.core.management.base import BaseCommand, CommandError
from openslides.core.config import config
from openslides.core.exceptions import ConfigError, ConfigNotFound
class Command(BaseCommand):
"""
Command to change OpenSlides config values.
"""
help = "Changes OpenSlides config values."
def add_arguments(self, parser):
parser.add_argument(
"key", help="Config key. See config_variables.py in every app."
)
parser.add_argument(
"value", help='New config value. For a falsy boolean use "False".'
)
def handle(self, *args, **options):
if options["value"].lower() == "false":
options["value"] = False
try:
config[options["key"]] = options["value"]
except (ConfigError, ConfigNotFound) as e:
raise CommandError(str(e))
self.stdout.write(
self.style.SUCCESS(
f"Config {options['key']} successfully changed to {config[options['key']]}."
)
)