Using os.environ.get instead of our in-house get_environ...
This commit is contained in:
parent
1d879fb78c
commit
d92b4a40e0
2 changed files with 7 additions and 8 deletions
|
@ -19,9 +19,10 @@ from src.config import config
|
||||||
from src.models import db
|
from src.models import db
|
||||||
from src.views.errors import error_pages
|
from src.views.errors import error_pages
|
||||||
from src.views.scoreboard import scoreboard
|
from src.views.scoreboard import scoreboard
|
||||||
from src.resources.utilities import cache, get_env_variable
|
from src.resources.utilities import cache
|
||||||
import flask_bootstrap
|
import flask_bootstrap
|
||||||
import flask
|
import flask
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
def create_app(config_name):
|
def create_app(config_name):
|
||||||
|
@ -37,11 +38,10 @@ def create_app(config_name):
|
||||||
|
|
||||||
return app
|
return app
|
||||||
|
|
||||||
configuration = get_env_variable("BSFLASK_ENV", fallback="default")
|
configuration = os.environ.get("BSFLASK_ENV", "default")
|
||||||
app = create_app(configuration)
|
app = create_app(configuration)
|
||||||
print("Running with", configuration, "configuration setting.")
|
print("Running with", configuration, "configuration setting.")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(app.config["BIND_IP"], app.config["BIND_PORT"])
|
app.run(app.config["BIND_IP"], app.config["BIND_PORT"])
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
from src.models import db
|
from src.models import db
|
||||||
from src.resources.utilities import get_env_variable
|
|
||||||
|
|
||||||
basedir = os.path.abspath(os.path.dirname(__file__))
|
basedir = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
|
@ -62,10 +61,10 @@ class ProductionConfig(Config):
|
||||||
BOOTSTRAP_USE_MINIFIED = True
|
BOOTSTRAP_USE_MINIFIED = True
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
# Database Configuration
|
# Database Configuration
|
||||||
MYSQL_USERNAME = get_env_variable("BSFLASK_MYSQL_USERNAME", fallback=None)
|
MYSQL_USERNAME = os.environ.get("BSFLASK_MYSQL_USERNAME", None)
|
||||||
MYSQL_PASSWORD = get_env_variable("BSFLASK_MYSQL_PASSWORD", fallback=None)
|
MYSQL_PASSWORD = os.environ.get("BSFLASK_MYSQL_PASSWORD", None)
|
||||||
MYSQL_HOSTNAME = get_env_variable("BSFLASK_MYSQL_HOSTNAME", fallback=None)
|
MYSQL_HOSTNAME = os.environ.get("BSFLASK_MYSQL_HOSTNAME", None)
|
||||||
MYSQL_DATABASE = get_env_variable("BSFLASK_MYSQL_DATABASE", fallback=None)
|
MYSQL_DATABASE = os.environ.get("BSFLASK_MYSQL_DATABASE", None)
|
||||||
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://{username}:{password}@{hostname}/{database}'\
|
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://{username}:{password}@{hostname}/{database}'\
|
||||||
.format(username=MYSQL_USERNAME, password=MYSQL_PASSWORD,
|
.format(username=MYSQL_USERNAME, password=MYSQL_PASSWORD,
|
||||||
hostname=MYSQL_HOSTNAME, database=MYSQL_DATABASE)
|
hostname=MYSQL_HOSTNAME, database=MYSQL_DATABASE)
|
||||||
|
|
Loading…
Reference in a new issue