Remove --nostatic and --insecure args to runserver command if staticfiles app is not installed. (#559)

This commit is contained in:
Thomas Fossati 2025-05-23 20:29:43 +02:00 committed by GitHub
parent ce3e7f6156
commit 1502de002c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -73,18 +73,19 @@ class Command(RunserverCommand):
"seconds (default: 5)"
),
)
parser.add_argument(
"--nostatic",
action="store_false",
dest="use_static_handler",
help="Tells Django to NOT automatically serve static files at STATIC_URL.",
)
parser.add_argument(
"--insecure",
action="store_true",
dest="insecure_serving",
help="Allows serving static files even if DEBUG is False.",
)
if apps.is_installed("django.contrib.staticfiles"):
parser.add_argument(
"--nostatic",
action="store_false",
dest="use_static_handler",
help="Tells Django to NOT automatically serve static files at STATIC_URL.",
)
parser.add_argument(
"--insecure",
action="store_true",
dest="insecure_serving",
help="Allows serving static files even if DEBUG is False.",
)
def handle(self, *args, **options):
self.http_timeout = options.get("http_timeout", None)