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
And finally run the worker in parallel to your fastapi application.
1140
1140
1141
1141
If you are using `docker compose`, the worker is already running.
1142
-
If you are doing it from scratch, run while in the `src` folder:
1142
+
If you are doing it from scratch, run while in the `root` folder:
1143
1143
```sh
1144
-
poetry run arq app.worker.WorkerSettings
1144
+
poetry run arq src.app.worker.WorkerSettings
1145
1145
```
1146
1146
### 5.11 Rate Limiting
1147
1147
To limit how many times a user can make a request in a certain interval of time (very useful to create subscription plans or just to protect your API against DDOS), you may just use the `rate_limiter` dependency:
@@ -1301,14 +1301,14 @@ docker compose up
1301
1301
```
1302
1302
1303
1303
If you are doing it from scratch, ensure your postgres and your redis are running, then
1304
-
while in the `src` folder, run to start the application with uvicorn server:
1304
+
while in the `root` folder, run to start the application with uvicorn server:
1305
1305
```sh
1306
-
poetry run uvicorn app.main:app --reload
1306
+
poetry run uvicorn src.app.main:app --reload
1307
1307
```
1308
1308
1309
1309
And for the worker:
1310
1310
```sh
1311
-
poetry run arq app.worker.WorkerSettings
1311
+
poetry run arq src.app.worker.WorkerSettings
1312
1312
```
1313
1313
1314
1314
## 6. Running in Production
@@ -1366,7 +1366,7 @@ To run with NGINX, you start by uncommenting the following part in your `docker-
1366
1366
# docker-compose.yml
1367
1367
1368
1368
...
1369
-
# #-------- uncomment to run with nginx --------
1369
+
#-------- uncomment to run with nginx --------
1370
1370
# nginx:
1371
1371
# image: nginx:latest
1372
1372
# ports:
@@ -1501,20 +1501,20 @@ Now, to run:
1501
1501
### 7.1 Docker Compose
1502
1502
First you need to uncomment the following part in the `docker-compose.yml` file:
1503
1503
```
1504
-
# #-------- uncomment to run tests --------
1504
+
#-------- uncomment to run tests --------
1505
1505
# pytest:
1506
1506
# build:
1507
1507
# context: .
1508
1508
# dockerfile: Dockerfile
1509
1509
# env_file:
1510
-
# - ./src/.env
1510
+
# - ./src/.env
1511
1511
# depends_on:
1512
1512
# - db
1513
1513
# - create_superuser
1514
1514
# - redis
1515
-
# command: python -m pytest
1515
+
# command: python -m pytest ./tests
1516
1516
# volumes:
1517
-
# - ./src:/code/src
1517
+
# - .:/code
1518
1518
```
1519
1519
1520
1520
You'll get:
@@ -1525,14 +1525,14 @@ You'll get:
1525
1525
context: .
1526
1526
dockerfile: Dockerfile
1527
1527
env_file:
1528
-
- ./src/.env
1528
+
- ./src/.env
1529
1529
depends_on:
1530
1530
- db
1531
1531
- create_superuser
1532
1532
- redis
1533
-
command: python -m pytest
1533
+
command: python -m pytest ./tests
1534
1534
volumes:
1535
-
- ./src:/code/src
1535
+
- .:/code
1536
1536
```
1537
1537
1538
1538
Start the Docker Compose services:
@@ -1548,7 +1548,7 @@ docker-compose run --rm pytest
1548
1548
1549
1549
### 7.2 From Scratch
1550
1550
1551
-
While in the `src` folder, run:
1551
+
While in the `root` folder, run:
1552
1552
```sh
1553
1553
poetry run python -m pytest
1554
1554
```
@@ -1557,7 +1557,7 @@ poetry run python -m pytest
1557
1557
Contributions are appreciated, even if just reporting bugs, documenting stuff or answering questions. To contribute with a feature:
1558
1558
1. Fork it (https://github.com/igormagalhaesr/FastAPI-boilerplate)
1559
1559
2. Create your feature branch (`git checkout -b feature/fooBar`)
1560
-
3. Test your changes while in the src folder `poetry run python -m pytest`
1560
+
3. Test your changes while in the root folder `poetry run python -m pytest`
1561
1561
4. Commit your changes (`git commit -am 'Add some fooBar'`)
1562
1562
5. Push to the branch (`git push origin feature/fooBar`)
0 commit comments