Fix start script broken by r550
Defer importing modules that require the DJANGO_SETTINGS_MODULE to be available until prepare_openslides() had a chance to set everything up.
This commit is contained in:
parent
7b7f43b04a
commit
8da2f0f041
@ -22,10 +22,8 @@ import webbrowser
|
|||||||
from contextlib import nested
|
from contextlib import nested
|
||||||
|
|
||||||
import django.conf
|
import django.conf
|
||||||
from django.db import DatabaseError
|
|
||||||
from django.core.management import execute_from_command_line
|
from django.core.management import execute_from_command_line
|
||||||
from django.utils.crypto import get_random_string
|
from django.utils.crypto import get_random_string
|
||||||
from django.contrib.auth.models import User
|
|
||||||
|
|
||||||
import openslides
|
import openslides
|
||||||
|
|
||||||
@ -143,6 +141,10 @@ def run_syncdb():
|
|||||||
|
|
||||||
def check_database():
|
def check_database():
|
||||||
"""Detect if database was deleted and recreate if necessary"""
|
"""Detect if database was deleted and recreate if necessary"""
|
||||||
|
# can't be imported in global scope as they already require
|
||||||
|
# the settings module during import
|
||||||
|
from django.db import DatabaseError
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
try:
|
try:
|
||||||
User.objects.count()
|
User.objects.count()
|
||||||
@ -153,7 +155,9 @@ def check_database():
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def create_or_reset_admin_user():
|
def create_or_reset_admin_user():
|
||||||
|
# can't be imported in global scope as it already requires
|
||||||
|
# the settings module during import
|
||||||
|
from django.contrib.auth.models import User
|
||||||
try:
|
try:
|
||||||
obj = User.objects.get(username = "admin")
|
obj = User.objects.get(username = "admin")
|
||||||
except User.DoesNotExist:
|
except User.DoesNotExist:
|
||||||
|
Loading…
Reference in New Issue
Block a user