Issue
I have developed an application with flask, and I want to publish it for production, but I do not know how to make a separation between the production and development environment (database and code), have you documents to help me or code. I specify in the config.py file the two environment but I do not know how to do with.
class DevelopmentConfig(Config):
"""
Development configurations
"""
DEBUG = True
SQLALCHEMY_ECHO = True
ASSETS_DEBUG = True
DATABASE = 'teamprojet_db'
print('THIS APP IS IN DEBUG MODE. YOU SHOULD NOT SEE THIS IN PRODUCTION.')
class ProductionConfig(Config):
"""
Production configurations
"""
DEBUG = False
DATABASE = 'teamprojet_prod_db'
Solution
To add onto Daniel's answer:
Flask has a page in its documentation that discusses this very issue.
Since you've specified your configuration in classes, you would load your configuration with app.config.from_object('configmodule.ProductionConfig')
Answered By - Nathan Wailes
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.