Load configuration based on the ENV environment variable
This commit is contained in:
parent
bed00e45f6
commit
a0d630d9bf
@ -14,13 +14,18 @@
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
|
||||
from flask import Flask, render_template
|
||||
|
||||
|
||||
class CalendarSocialApp(Flask):
|
||||
def __init__(self, name):
|
||||
def __init__(self, name, config=None):
|
||||
Flask.__init__(self, name)
|
||||
|
||||
config_name = os.environ.get('ENV', config or 'dev')
|
||||
self.config.from_pyfile(f'config_{config_name}.py', True)
|
||||
|
||||
|
||||
app = CalendarSocialApp(__name__)
|
||||
|
||||
|
2
app/config_dev.py
Normal file
2
app/config_dev.py
Normal file
@ -0,0 +1,2 @@
|
||||
DEBUG = True
|
||||
ENV = 'dev'
|
Loading…
Reference in New Issue
Block a user