Merge branch 'master' of github.com:NyxiumYuuki/FlaskALED
This commit is contained in:
commit
d556784983
3 changed files with 8 additions and 10 deletions
|
|
@ -1,9 +1,8 @@
|
|||
from application import create_app
|
||||
import os
|
||||
|
||||
app = create_app()
|
||||
app = create_app(os.environ.get('FLASK_ENV', None))
|
||||
|
||||
if __name__ == "__main__":
|
||||
PORT = os.environ.get('PORT', 33507)
|
||||
print('app.run')
|
||||
app.run(host='0.0.0.0', port=PORT, DEBUG=True)
|
||||
|
|
|
|||
|
|
@ -6,14 +6,13 @@ import os
|
|||
db = SQLAlchemy()
|
||||
|
||||
|
||||
def create_app():
|
||||
def create_app(flask_env='development'):
|
||||
app = Flask(__name__, instance_relative_config=False)
|
||||
FLASK_ENV = os.environ.get('FLASK_ENV', None)
|
||||
if FLASK_ENV == 'production':
|
||||
if flask_env == 'production':
|
||||
app.config.from_object("config.ProductionConfig")
|
||||
elif FLASK_ENV == 'staging':
|
||||
app.config.from_object("config.StagingConfig")
|
||||
elif FLASK_ENV == 'development':
|
||||
elif flask_env == 'testing':
|
||||
app.config.from_object("config.TestingConfig")
|
||||
elif flask_env == 'development':
|
||||
app.config.from_object("config.DevelopmentConfig")
|
||||
else:
|
||||
app.config.from_object("config.Config")
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ class ProductionConfig(Config):
|
|||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||
|
||||
|
||||
class StagingConfig(Config):
|
||||
STAGING = True
|
||||
class TestingConfig(Config):
|
||||
TESTING = True
|
||||
SQLALCHEMY_ECHO = False
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue