parent
03cb8592fe
commit
667a841051
@ -215,10 +215,6 @@ def start(args):
|
||||
# A manual given environment variable will be overwritten
|
||||
setup_django_settings_module(settings_path, local_installation=local_installation)
|
||||
django.setup()
|
||||
from django.conf import settings
|
||||
|
||||
if args.debug_email:
|
||||
settings.EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
||||
|
||||
# Migrate database
|
||||
call_command("migrate")
|
||||
@ -232,7 +228,7 @@ def start(args):
|
||||
# Start the built-in webserver
|
||||
#
|
||||
# Use flag --noreload to tell Django not to reload the server.
|
||||
# Therefor we have to set the keyword noreload to False because Django
|
||||
# Therefore we have to set the keyword noreload to False because Django
|
||||
# parses this directly to the use_reloader keyword.
|
||||
#
|
||||
# Use flag --insecure to serve static files even if DEBUG is False.
|
||||
@ -241,6 +237,7 @@ def start(args):
|
||||
f"{args.host}:{args.port}",
|
||||
noreload=False, # Means True, see above.
|
||||
insecure=True,
|
||||
debug_email=args.debug_email,
|
||||
)
|
||||
|
||||
|
||||
|
26
server/openslides/core/management/commands/runserver.py
Normal file
26
server/openslides/core/management/commands/runserver.py
Normal file
@ -0,0 +1,26 @@
|
||||
from django.contrib.staticfiles.management.commands.runserver import (
|
||||
Command as RunserverCommand,
|
||||
)
|
||||
|
||||
|
||||
class Command(RunserverCommand):
|
||||
"""
|
||||
Enables the --debug-email flag
|
||||
"""
|
||||
|
||||
def add_arguments(self, parser):
|
||||
super().add_arguments(parser)
|
||||
parser.add_argument(
|
||||
"--debug-email",
|
||||
action="store_true",
|
||||
help="Change the email backend to console output.",
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
from django.conf import settings
|
||||
|
||||
if options["debug_email"]:
|
||||
self.stdout.write("Enabled debug email")
|
||||
settings.EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
||||
|
||||
return super().handle(*args, **options)
|
Loading…
Reference in New Issue
Block a user