Permalink
Browse files

Force local settings

  • Loading branch information...
klen committed Oct 2, 2012
1 parent f8bed4f commit 3e0a9eeadcfb3caa5c22bb8d12a62b3eba301208
Showing with 14 additions and 7 deletions.
  1. +5 −4 .gitignore
  2. +9 −3 base/app.py
View
@@ -1,8 +1,9 @@
-*.pyc
+._
+base/config/local.py
+.db
.env
+*.py[co]
.ropeproject
+.tags
.tests
.vimrc
-.db
-.tags
-._
View
@@ -1,17 +1,23 @@
from flask import Flask
-from os import environ
+from os import environ, path as op
from .config import production
def create_app(config=None, **settings):
app = Flask(__name__)
-
- app.config.from_object(config or production)
app.config.from_envvar("APP_SETTINGS", silent=True)
+ app.config.from_object(config or production)
+
+ # Settings from mode
mode = environ.get('MODE')
if mode:
app.config.from_object('base.config.%s' % mode)
+
+ # Local settings
+ app.config.from_pyfile(op.join(op.dirname(production.__file__), 'local.py'), silent=True)
+
+ # Overide settings
app.config.update(settings)
with app.test_request_context():

0 comments on commit 3e0a9ee

Please sign in to comment.