together_backend/README.md

89 lines
1.2 KiB
Markdown
Raw Normal View History

2024-04-11 17:38:13 +08:00
# 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
```
# Run Container
Create a volume for persisting data:
```shell
docker volumn create together-backend
```
Run a container and mount the volume:
```shell
docker run --name together-backend \
-v together-backend:/backend/static \
-itd 120.77.202.88/together-backend-dev:v1.0
```
2024-04-11 17:38:13 +08:00