Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added the function to populate the database automatically #1236

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -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=""
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down
1 change: 1 addition & 0 deletions api/utils/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 3 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Loading