73 lines
934 B
Markdown
73 lines
934 B
Markdown
# Initialization
|
|
|
|
## Virtue Environment
|
|
|
|
First install `pipenv` (if you don't have) running:
|
|
|
|
```shell
|
|
pip install pipenv
|
|
```
|
|
|
|
Then use `pipenv` to create virtue environment running in the root directory of the project:
|
|
|
|
```shell
|
|
pipenv install
|
|
```
|
|
|
|
This command will install all the dependencies.
|
|
|
|
## Requirements
|
|
|
|
Generate requirements file running
|
|
|
|
```shell
|
|
pipenv requirements > requirements.txt
|
|
```
|
|
|
|
# Start Up
|
|
|
|
Start up the app according to different environment variables running:
|
|
|
|
## fastapi
|
|
|
|
```shell
|
|
uvicorn src.main:app --reload --env-file ./.local.env
|
|
```
|
|
|
|
# Migration
|
|
|
|
## Generate a migration
|
|
|
|
```shell
|
|
alembic revision -m "comment" --autogenerate
|
|
```
|
|
|
|
## Upgrade a migration
|
|
|
|
This will upgrade to the newest version
|
|
|
|
```shell
|
|
alembic upgrade head
|
|
```
|
|
|
|
or:
|
|
|
|
```shell
|
|
alembic upgrade verions_name
|
|
```
|
|
|
|
or relative upgrades:
|
|
|
|
```shell
|
|
alembe upgrade +1
|
|
```
|
|
|
|
## Downgrade a migration
|
|
|
|
```shell
|
|
alembic downgrade -1
|
|
```
|
|
|
|
|
|
|