diff --git a/settings.py b/settings.py index 11378a8d01db..c7e931c78828 100644 --- a/settings.py +++ b/settings.py @@ -132,17 +132,13 @@ 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('# Put settings you want to overload in this file.\n') + +from local_settings import * # noqa SITEMAP_DEBUG_AVAILABLE = True