diff --git a/app/config.py b/app/config.py index a71411b0..f412d801 100644 --- a/app/config.py +++ b/app/config.py @@ -24,6 +24,7 @@ if config_file: else: load_dotenv() +RESET_DB = "RESET_DB" in os.environ # Allow user to have 1 year of premium: set the expiration_date to 1 year more PROMO_CODE = "SIMPLEISBETTER" diff --git a/server.py b/server.py index 2542f17b..0e5b733c 100644 --- a/server.py +++ b/server.py @@ -20,6 +20,7 @@ from app.config import ( URL, SHA1, PADDLE_MONTHLY_PRODUCT_ID, + RESET_DB, ) from app.dashboard.base import dashboard_bp from app.developer.base import developer_bp @@ -379,9 +380,10 @@ if __name__ == "__main__": # app.config["SQLALCHEMY_ECHO"] = True # warning: only used in local - # LOG.d("reset db, add fake data") - # with app.app_context(): - # fake_data() + if RESET_DB: + LOG.warning("reset db, add fake data") + with app.app_context(): + fake_data() if URL.startswith("https"): LOG.d("enable https")