You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: backend/README.md
+9-43Lines changed: 9 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,45 +5,11 @@
5
5
*[Docker](https://www.docker.com/).
6
6
*[Poetry](https://python-poetry.org/) for Python package and environment management.
7
7
8
-
## Local Development
8
+
## Docker Compose
9
9
10
-
*Start the stack with Docker Compose:
10
+
Start the local development environment with Docker Compose following the guide in [../development.md](../development.md).
11
11
12
-
```bash
13
-
docker compose up -d
14
-
```
15
-
16
-
* Now you can open your browser and interact with these URLs:
17
-
18
-
Frontend, built with Docker, with routes handled based on the path: http://localhost
19
-
20
-
Backend, JSON based web API based on OpenAPI: http://localhost/api/
21
-
22
-
Automatic interactive documentation with Swagger UI (from the OpenAPI backend): http://localhost/docs
23
-
24
-
Adminer, database web administration: http://localhost:8080
25
-
26
-
Traefik UI, to see how the routes are being handled by the proxy: http://localhost:8090
27
-
28
-
**Note**: The first time you start your stack, it might take a minute for it to be ready. While the backend waits for the database to be ready and configures everything. You can check the logs to monitor it.
29
-
30
-
To check the logs, run:
31
-
32
-
```bash
33
-
docker compose logs
34
-
```
35
-
36
-
To check the logs of a specific service, add the name of the service, e.g.:
37
-
38
-
```bash
39
-
docker compose logs backend
40
-
```
41
-
42
-
If your Docker is not running in `localhost` (the URLs above wouldn't work) you would need to use the IP or domain where your Docker is running.
43
-
44
-
## Backend local development, additional details
45
-
46
-
### General workflow
12
+
## General Workflow
47
13
48
14
By default, the dependencies are managed with [Poetry](https://python-poetry.org/), go there and install it.
49
15
@@ -63,13 +29,13 @@ Make sure your editor is using the correct Python virtual environment.
63
29
64
30
Modify or add SQLModel models for data and SQL tables in `./backend/app/models.py`, API endpoints in `./backend/app/api/`, CRUD (Create, Read, Update, Delete) utils in `./backend/app/crud.py`.
65
31
66
-
###VS Code
32
+
## VS Code
67
33
68
34
There are already configurations in place to run the backend through the VS Code debugger, so that you can use breakpoints, pause and explore variables, etc.
69
35
70
36
The setup is also already configured so you can run the tests through the VS Code Python tests tab.
71
37
72
-
###Docker Compose Override
38
+
## Docker Compose Override
73
39
74
40
During development, you can change Docker Compose settings that will only affect the local development environment in the file `docker-compose.override.yml`.
75
41
@@ -123,7 +89,7 @@ Nevertheless, if it doesn't detect a change but a syntax error, it will just sto
123
89
124
90
...this previous detail is what makes it useful to have the container alive doing nothing and then, in a Bash session, make it run the live reload server.
125
91
126
-
###Backend tests
92
+
## Backend tests
127
93
128
94
To test the backend run:
129
95
@@ -135,7 +101,7 @@ The tests run with Pytest, modify and add tests to `./backend/app/tests/`.
135
101
136
102
If you use GitHub Actions the tests will run automatically.
137
103
138
-
####Test running stack
104
+
### Test running stack
139
105
140
106
If your stack is already up and you just want to run the tests, you can use:
141
107
@@ -151,11 +117,11 @@ For example, to stop on first error:
When the tests are run, a file `htmlcov/index.html` is generated, you can open it in your browser to see the coverage of the tests.
157
123
158
-
###Migrations
124
+
## Migrations
159
125
160
126
As during local development your app directory is mounted as a volume inside the container, you can also run the migrations with `alembic` commands inside the container and the migration code will be in your app directory (instead of being only inside the container). So you can add it to your git repository.
0 commit comments