Skip to content

Commit 82f92f3

Browse files
committed
get config from object instead of env.
1 parent 929b5b7 commit 82f92f3

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
from flask import Flask
22
app = Flask(__name__)
3-
app.config.from_envvar('TANUKI_CONFIG', silent=False)
4-
app.debug = app.config["DEBUG"]
5-
63
import tanuki.views
74

85
# this package wants something external to run app

settings.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class DefaultConfig:
2+
DEBUG = True
3+
4+
class ProductionConfig:
5+
DEBUG = False
6+

views.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1+
import os
2+
13
from flask import request, redirect, url_for
24
from flask.ext.bower import Bower
35
from lib import Tanuki
4-
from tanuki import app
6+
from tanuki import app, settings
57

68
__author__ = "siznax"
79
__date__ = "Jan 2015"
810

9-
app.config.from_envvar('TANUKI_CONFIG', silent=False)
10-
Bower(app)
11+
app.config.from_object(settings.DefaultConfig)
12+
if '/var/www/' in os.getcwd():
13+
app.config.from_object(settings.ProductionConfig)
1114

15+
Bower(app)
1216
applib = Tanuki(app.config)
1317

1418

0 commit comments

Comments
 (0)