https://github.com/kennytian/python-prisma-boot
https://github.com/kennytian/python-prisma-boot
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/kennytian/python-prisma-boot
- Owner: Kennytian
- License: mit
- Created: 2024-11-27T13:50:54.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-11-29T08:41:46.000Z (about 1 year ago)
- Last Synced: 2025-03-23T10:19:58.987Z (9 months ago)
- Language: Python
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Python Prisma Boot
## 1. Environment
### 1.1 Create .venv
General Linux
```shell
python -m venv .venv
```
macOS
```shell
python3 -m venv .venv
```
Ubuntu
```
apt-get update && apt install python3.10-venv
```
### 1.2 Activate
```shell
source .venv/bin/activate
```
## 2. Setup
### 2.1 Install dependencies
```shell
pip install -r requirements.txt
```
or
```shell
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
```
### 2.2 Generate database types
```shell
cp .env.example .env
```
```shell
prisma generate
```
## 3. Run
```shell
uvicorn main:app --reload
```
## 4. Database
```shell
prisma db push
```
```shell
prisma db pull
```
## 5. Docker
### 5.1 Build
```shell
docker build -t python-prisma -f Dockerfile .
```
### 5.2 Run
```shell
docker rm -f python-app;docker run --env-file .env -p 8123:8000 -d --name python-app python-prisma:latest
```
or
```shell
docker-compose down && docker-compose up -d && docker image prune -f && docker-compose logs -f
```
## Test
```shell
curl http://localhost:8123
```