Skip to content

Commit

Permalink
Allows static files to be served in non-debug mode
Browse files Browse the repository at this point in the history
There is a simple flag that allows it. While we really should be not
using the django server, this is OK for now. This is necessary as django
does not, by default, serve static files in non-debug mode. We want that
to happen so someone can run this. We will be providing a more
production-blessed path soon, but this unblocks our users.
  • Loading branch information
elijahbenizzy committed Jun 30, 2024
1 parent 25cc2cc commit 83b00cb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ui/backend/server/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,13 @@ def run(
env = {**_load_env(config_file), **env}
with set_env_variables(env):
settings_file_param = f"--settings={settings_file.value}"
# execute_from_command_line(["manage.py", "collectstatic", settings_file_param])
if not no_migration:
execute_from_command_line(["manage.py", "migrate", settings_file_param])
execute_from_command_line(
["manage.py", "runserver", settings_file_param, f"0.0.0.0:{port}"]
# Why insecure? Because we're running locally using django's server which
# is not specifically meant for production. That said, we'll be fixing this up shortly,
# but for now, users who want to run this not in debug mode and serve it will want to use this:
# See https://stackoverflow.com/questions/5836674/why-does-debug-false-setting-make-my-django-static-files-access-fail
["manage.py", "runserver", settings_file_param, f"0.0.0.0:{port}", "--insecure"]
)

0 comments on commit 83b00cb

Please sign in to comment.