Skip to content

Commit 651454d

Browse files
authored
Create README.md
1 parent 2f2d8fb commit 651454d

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

README.md

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# ClassTranscribe Python API
2+
3+
Powered by Flask + Connexion + SQLAlchemy
4+
5+
## Build Status
6+
7+
| Branch | Status |
8+
|-------:|--------|
9+
| Production | ![Production](https://github.com/classtranscribe/pyapi/actions/workflows/docker.yml/badge.svg?event=push&branch=main) |
10+
| Staging | ![Staging](https://github.com/classtranscribe/pyapi/actions/workflows/docker.yml/badge.svg?event=push&branch=staging) |
11+
| Experiment | ![Experiment](https://github.com/classtranscribe/pyapi/actions/workflows/docker.yml/badge.svg?event=push&branch=expt) |
12+
13+
## Configuration
14+
Environment variables can be used to set the configuration.
15+
16+
### Application Config
17+
| Environment Variable | Description | Default Value |
18+
| ------ | ----------- | ----- |
19+
| DEBUG | Enable verbose debug output | `False` |
20+
| PORT | The port to serve the Flask app | 5000 |
21+
| SWAGGER_URL | local or remote URL to the Swagger spec that this application uses | `openapi/swagger.json` |
22+
23+
### Database Connection Config
24+
You can choose to connect to a remote postgres instance, or use a local SQLite file (recommended for dev only)
25+
26+
| Environment Variable | Description | Default Value |
27+
| ------ | ----------- | ----- |
28+
| USE_SQLITE | Use a local database file (instead of postgres, for local dev only) | True |
29+
| POSTGRES_HOST | Hostname of a remote Postgres to connect to | `localhost` |
30+
| POSTGRES_PORT | Port of a remote Postgres to connect to | 5432 |
31+
| POSTGRES_USER | Username to use when connecting to remote Postgres | '' |
32+
| POSTGRES_PASS | Password to use when connecting to remote Postgres | '' |
33+
| POSTGRES_DB | Database to use when connecting to remote Postgres | `ct2019db` |
34+
35+
NOTE: By default, a sqlite file will be created.
36+
37+
## Getting Started
38+
This project can either be run with Python or as a Docker container.
39+
40+
To run all of ClassTranscribe locally (including the frontend and C# backend) see RunEverything.md
41+
42+
### With Python
43+
Install dependencies:
44+
```bash
45+
pip install -r requirements.txt
46+
```
47+
48+
Run the application:
49+
```bash
50+
python server.py
51+
```
52+
53+
Navigate to http://localhost:5000/ui/ to test the API with Swagger UI.
54+
55+
### With Docker
56+
Build the Docker image:
57+
```bash
58+
docker build -t classtranscribe/pyapi .
59+
```
60+
61+
Run a Docker container from that image:
62+
```bash
63+
docker run -itd --name ct-pyapi -p 5000:5000 classtranscribe/pyapi
64+
```
65+
66+
Navigate to http://localhost:5000/ui/ to test the API with Swagger UI.
67+
68+
NOTE: In Docker on Mac/Windows, you may need to use your IP address instead of localhost.
69+
70+
### With Docker Compose
71+
Build and run the pyapi application, along with `postgres` and `rabbitmq`:
72+
```bash
73+
docker compose -f docker/docker-compose.yml up -d --build
74+
```
75+
76+
You can change the code and/or `.env` files located in the Docker directory to change the behavior of the application.
77+
78+
NOTE: `--build` will automatically rebuild the Docker image needed for this stack
79+
80+
Navigate to http://localhost:5000/ui/ to test the API with Swagger UI.
81+
82+
NOTE: In Docker on Mac/Windows, you may need to use your IP address instead of localhost.

0 commit comments

Comments
 (0)