From f2dbc4a75b8325e9c347f1f68cc22a3a00fcfa9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Fri, 31 Jan 2014 16:57:15 +0100 Subject: [PATCH] Use config from settings.py This enables to use a settings.py in the base directory of the repo, if no environment variable set. --- .gitignore | 3 +++ README.rst | 6 ++++-- dev.py | 6 ++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index d2d6f36..f7aa916 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,6 @@ nosetests.xml .mr.developer.cfg .project .pydevproject + +# PuppetDB Settings +/settings.py diff --git a/README.rst b/README.rst index e89b72c..ba465c5 100644 --- a/README.rst +++ b/README.rst @@ -133,8 +133,10 @@ You can run it in development mode by simply executing: $ python dev.py Use ``PUPPETBOARD_SETTINGS`` to change the different settings or patch -``default_settings.py`` directly. Take care not to include your local -changes on that file when submitting patches for Puppetboard. +``default_settings.py`` directly. Take care not to include your local changes on +that file when submitting patches for Puppetboard. Place a settings.py file +inside the base directory of the git repository that will be used, if the +environment variable is not set. Production ---------- diff --git a/dev.py b/dev.py index 313a58f..0bce7aa 100644 --- a/dev.py +++ b/dev.py @@ -1,5 +1,11 @@ from __future__ import unicode_literals from __future__ import absolute_import +import os + +if 'PUPPETBOARD_SETTINGS' not in os.environ: + os.environ['PUPPETBOARD_SETTINGS'] = os.path.join( + os.getcwd(), 'settings.py' + ) from puppetboard.app import app from puppetboard.default_settings import DEV_LISTEN_HOST, DEV_LISTEN_PORT