From daaaa4427c65a4c44f4596c103029be92bc2b0ea Mon Sep 17 00:00:00 2001 From: Toluwaloju0 <teecoded1999@gmail.com> Date: Sun, 2 Mar 2025 21:51:35 +0100 Subject: [PATCH] addded populate roles to main --- .env.sample | 1 + README.md | 3 ++- api/utils/settings.py | 1 + main.py | 3 +++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.env.sample b/.env.sample index 651fd88b8..79600634e 100644 --- a/.env.sample +++ b/.env.sample @@ -41,5 +41,6 @@ MAILJET_API_KEY='MAIL JET API KEY' MAILJET_API_SECRET='SECRET KEY' APP_NAME="fastapi_boilerplate" +DEV_MODE="test" TELEX_WEBHOOK_URL="" diff --git a/README.md b/README.md index bd395fb5a..5a00fe884 100644 --- a/README.md +++ b/README.md @@ -245,7 +245,8 @@ Then retry: ```sh alembic revision --autogenerate -m 'your migration message' ``` - +if running this boiler_plate on a test server confirm that the dev type is test +this would enable the database to have populated datas for you to use --- ## **Contribution Guidelines** diff --git a/api/utils/settings.py b/api/utils/settings.py index 9b064f608..47f06361a 100644 --- a/api/utils/settings.py +++ b/api/utils/settings.py @@ -35,6 +35,7 @@ class Settings(BaseSettings): TWILIO_PHONE_NUMBER: str = config("TWILIO_PHONE_NUMBER") APP_NAME: str = config("APP_NAME") + DEV_MODE:str = config("DEV_MODE") # Base URLs ANCHOR_PYTHON_BASE_URL: str = config( diff --git a/main.py b/main.py index e72225227..5976c939f 100644 --- a/main.py +++ b/main.py @@ -177,5 +177,8 @@ async def global_exception(request: Request, exc: Exception): os.makedirs(STATIC_DIR, exist_ok=True) app.mount("/static", StaticFiles(directory="static"), name="static") +if settings.DEV_MODE == "test": + populate_roles_and_permissions() + if __name__ == "__main__": uvicorn.run("main:app", port=7001, reload=True)