diff --git a/Dockerfile b/Dockerfile index c243c491c6d6..1de74b6913bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -102,11 +102,9 @@ RUN ln -s ${HOME}/package.json /deps/package.json \ WORKDIR ${HOME} # Build locales, assets, build id. -RUN echo "from olympia.lib.settings_base import *\n" \ -> settings_local.py && DJANGO_SETTINGS_MODULE='settings_local' locale/compile-mo.sh locale \ - && DJANGO_SETTINGS_MODULE='settings_local' python manage.py compress_assets \ - && DJANGO_SETTINGS_MODULE='settings_local' python manage.py generate_jsi18n_files \ - && DJANGO_SETTINGS_MODULE='settings_local' python manage.py collectstatic --noinput \ +RUN locale/compile-mo.sh locale \ + && python manage.py compress_assets \ + && python manage.py generate_jsi18n_files \ + && python manage.py collectstatic --noinput \ && npm prune --production \ - && ./scripts/generate_build.py > build.py \ - && rm -f settings_local.py settings_local.pyc + && ./scripts/generate_build.py > build.py diff --git a/settings.py b/settings.py index 11378a8d01db..23c62bacf4be 100644 --- a/settings.py +++ b/settings.py @@ -132,17 +132,16 @@ def insert_debug_toolbar_middleware(middlewares): REMOTE_SETTINGS_IS_TEST_SERVER = True -# If you have settings you want to overload, put them in a local_settings.py. -try: - from local_settings import * # noqa -except ImportError: - import traceback - import warnings - - warnings.warn( - 'Could not import local_settings module. {}'.format(traceback.format_exc()), - stacklevel=1, - ) +local_settings_path = path('local_settings.py') + +if not os.path.exists(local_settings_path): + with open(local_settings_path, 'w') as file: + file.write( + '# If you have settings you want to overload, put them in a local_settings.py.\n' + 'from olympia.lib.settings_base import *\n' + ) + +from local_settings import * # noqa SITEMAP_DEBUG_AVAILABLE = True