Skip to content

Commit

Permalink
Improve list of included base and project settings, re #8
Browse files Browse the repository at this point in the history
* Print actual `ixc_django_docker.settings` and project directories, to
  make it easier to find the files being included.

* Only print a one line warning if `DONT_PRINT_SETTINGS` environment
  variable is defined. Put `DONT_PRINT_SETTINGS=1` in `.env.local` if you
  don't want to see the included settings printed on startup.

  The warning is there just as a reminder that we're missing out on this
  information, and how to get it back.
  • Loading branch information
mrmachine committed Mar 6, 2018
1 parent 454e2c0 commit 29a6606
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions ixc_django_docker/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,22 @@ def _(module, from_dir):
optional(os.path.join(PROJECT_SETTINGS_DIR, 'local.py')))

# Tell users where settings are coming from.
print('BASE_SETTINGS:\n %s' % '\n '.join(
_(os.path.join(os.path.dirname(__file__), s), os.path.dirname(__file__))
for s in BASE_SETTINGS))
print('PROJECT_SETTINGS:\n %s' % '\n '.join(
_(os.path.join(PROJECT_DIR, s), PROJECT_DIR) for s in PROJECT_SETTINGS))
if os.environ.get('DONT_PRINT_SETTINGS'):
print(
'NOT printing actual base and project settings. Unset '
'`DONT_PRINT_SETTINGS` to change.')
else:
print('BASE_SETTINGS (%s):\n %s' % (
os.path.dirname(__file__),
'\n '.join(
_(os.path.join(os.path.dirname(__file__), s), os.path.dirname(__file__))
for s in BASE_SETTINGS),
))
print('PROJECT_SETTINGS (%s):\n %s' % (
PROJECT_DIR,
'\n '.join(
_(os.path.join(PROJECT_DIR, s), PROJECT_DIR) for s in PROJECT_SETTINGS),
))

# Include base and project settings modules.
include(*BASE_SETTINGS)
Expand Down

0 comments on commit 29a6606

Please sign in to comment.