API: app settings in env variable
This commit is contained in:
parent
2d9d3056c2
commit
824e98b996
@ -4,6 +4,7 @@ CLIENT_PORT = 3000
|
|||||||
|
|
||||||
export REACT_APP_API_URL = http://$(HOST):$(API_PORT)
|
export REACT_APP_API_URL = http://$(HOST):$(API_PORT)
|
||||||
export FLASK_APP = $(PWD)/mpwo_api/server.py
|
export FLASK_APP = $(PWD)/mpwo_api/server.py
|
||||||
|
export APP_SETTINGS=mpwo_api.config.DevelopmentConfig
|
||||||
export FLASK_DEBUG = 1
|
export FLASK_DEBUG = 1
|
||||||
export TEST_URL = http://$(HOST):$(CLIENT_PORT)
|
export TEST_URL = http://$(HOST):$(CLIENT_PORT)
|
||||||
export REQUIREMENTS = $(PWD)/mpwo_api/requirements.txt
|
export REQUIREMENTS = $(PWD)/mpwo_api/requirements.txt
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
from flask_bcrypt import Bcrypt
|
from flask_bcrypt import Bcrypt
|
||||||
@ -17,7 +18,8 @@ def create_app():
|
|||||||
|
|
||||||
# set config
|
# set config
|
||||||
with app.app_context():
|
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
|
# set up extensions
|
||||||
db.init_app(app)
|
db.init_app(app)
|
||||||
|
@ -29,7 +29,7 @@ class DevelopmentConfig(BaseConfig):
|
|||||||
|
|
||||||
|
|
||||||
class TestingConfig(BaseConfig):
|
class TestingConfig(BaseConfig):
|
||||||
"""Development configuration"""
|
"""Testing configuration"""
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
TESTING = True
|
TESTING = True
|
||||||
SQLALCHEMY_DATABASE_URI = \
|
SQLALCHEMY_DATABASE_URI = \
|
||||||
|
Loading…
Reference in New Issue
Block a user