OpenSlides/server/openslides/core/management/commands/migrate.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

30 lines
1.0 KiB
Python

import os
from django.core.management.commands.migrate import Command as _Command
from ...signals import post_permission_creation
class Command(_Command):
"""
Migration command that does nearly the same as Django's migration command
but also calls the post_permission_creation signal.
"""
def handle(self, *args, **options):
from django.conf import settings
# Creates the folder for a SQLite3 database if necessary.
if settings.DATABASES["default"]["ENGINE"] == "django.db.backends.sqlite3":
try:
os.makedirs(settings.OPENSLIDES_USER_DATA_PATH)
except (FileExistsError, AttributeError):
# If the folder already exists or the settings
# OPENSLIDES_USER_DATA_PATH is unknown, just do nothing.
pass
super().handle(*args, **options)
# Send this signal after sending post_migrate (inside super()) so that
# all Permission objects are created previously.
post_permission_creation.send(self)