More flexible, less error-prone configuration system.

WARNING: make a backup copy of your local config.py before pulling
this change, as Git will overwrite it without warning.

The configuration defaults to deployment settings, allowing overrides.
Overrides are read from config_local.py and from the file pointed to
by the PILLAR_CONFIG env var.
This commit is contained in:
2016-04-04 14:59:11 +02:00
parent a1930c63d0
commit 465b145609
7 changed files with 108 additions and 115 deletions

View File

@@ -32,28 +32,11 @@ MONGO_HOST = os.environ.get('MONGO_HOST', 'localhost')
@manager.command
def runserver():
try:
import config
PORT = config.Development.PORT
HOST = config.Development.HOST
DEBUG = config.Development.DEBUG
app.config['STORAGE_DIR'] = config.Development.STORAGE_DIR
except ImportError:
# Default settings
PORT = 5000
HOST = '0.0.0.0'
DEBUG = True
app.config['STORAGE_DIR'] = '{0}/application/static/storage'.format(
os.path.dirname(os.path.realpath(__file__)))
# Automatic creation of STORAGE_DIR path if it's missing
if not os.path.exists(app.config['STORAGE_DIR']):
os.makedirs(app.config['STORAGE_DIR'])
app.run(
port=PORT,
host=HOST,
debug=DEBUG)
app.run()
def post_item(entry, data):