API: app settings in env variable

This commit is contained in:
Sam 2018-04-10 21:53:18 +02:00
parent 2d9d3056c2
commit 824e98b996
3 changed files with 5 additions and 2 deletions

View File

@ -4,6 +4,7 @@ CLIENT_PORT = 3000
export REACT_APP_API_URL = http://$(HOST):$(API_PORT)
export FLASK_APP = $(PWD)/mpwo_api/server.py
export APP_SETTINGS=mpwo_api.config.DevelopmentConfig
export FLASK_DEBUG = 1
export TEST_URL = http://$(HOST):$(CLIENT_PORT)
export REQUIREMENTS = $(PWD)/mpwo_api/requirements.txt

View File

@ -1,4 +1,5 @@
import logging
import os
from flask import Flask
from flask_bcrypt import Bcrypt
@ -17,7 +18,8 @@ def create_app():
# set config
with app.app_context():
app.config.from_object('mpwo_api.config.DevelopmentConfig')
app_settings = os.getenv('APP_SETTINGS')
app.config.from_object(app_settings)
# set up extensions
db.init_app(app)

View File

@ -29,7 +29,7 @@ class DevelopmentConfig(BaseConfig):
class TestingConfig(BaseConfig):
"""Development configuration"""
"""Testing configuration"""
DEBUG = True
TESTING = True
SQLALCHEMY_DATABASE_URI = \