Replace: Stage to Test
This commit is contained in:
parent
bce2237303
commit
0a3ab090a6
3 changed files with 8 additions and 10 deletions
|
|
@ -1,9 +1,8 @@
|
||||||
from application import create_app
|
from application import create_app
|
||||||
import os
|
import os
|
||||||
|
|
||||||
app = create_app()
|
app = create_app(os.environ.get('FLASK_ENV', None))
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
PORT = os.environ.get('PORT', 33507)
|
PORT = os.environ.get('PORT', 33507)
|
||||||
print('app.run')
|
|
||||||
app.run(host='0.0.0.0', port=PORT, DEBUG=True)
|
app.run(host='0.0.0.0', port=PORT, DEBUG=True)
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,13 @@ import os
|
||||||
db = SQLAlchemy()
|
db = SQLAlchemy()
|
||||||
|
|
||||||
|
|
||||||
def create_app():
|
def create_app(flask_env='development'):
|
||||||
app = Flask(__name__, instance_relative_config=False)
|
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")
|
app.config.from_object("config.ProductionConfig")
|
||||||
elif FLASK_ENV == 'staging':
|
elif flask_env == 'testing':
|
||||||
app.config.from_object("config.StagingConfig")
|
app.config.from_object("config.TestingConfig")
|
||||||
elif FLASK_ENV == 'development':
|
elif flask_env == 'development':
|
||||||
app.config.from_object("config.DevelopmentConfig")
|
app.config.from_object("config.DevelopmentConfig")
|
||||||
else:
|
else:
|
||||||
app.config.from_object("config.Config")
|
app.config.from_object("config.Config")
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ class ProductionConfig(Config):
|
||||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||||
|
|
||||||
|
|
||||||
class StagingConfig(Config):
|
class TestingConfig(Config):
|
||||||
STAGING = True
|
TESTING = True
|
||||||
SQLALCHEMY_ECHO = False
|
SQLALCHEMY_ECHO = False
|
||||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue