File tree Expand file tree Collapse file tree 5 files changed +17
-90
lines changed Expand file tree Collapse file tree 5 files changed +17
-90
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,7 @@ RUN apt-get update && \
44 apt-get install -y make && \
55 pip install uv
66
7- ENV UV_LINK_MODE=copy
87ENV UV_COMPILE_BYTECODE=1
9- RUN --mount=type=cache,target=/root/.cache/uv
108
119WORKDIR /app
1210COPY . .
Original file line number Diff line number Diff line change 99run :
1010 uv run gunicorn -w 4 -b 0.0.0.0:$(PORT ) app.server:app
1111
12- start :
13- make stop rm || true
14- docker run -p $(PORT ) :$(PORT ) data-charts-api make run
15-
1612build :
1713 docker build . --tag=data-charts-api
1814
15+ start :
16+ -docker stop data-charts-api
17+ -docker rm data-charts-api
18+ docker run -d --name data-charts-api -p $(PORT ) :$(PORT ) data-charts-api
19+
1920stop :
20- docker stop data-charts-api
21+ - docker stop data-charts-api
2122
2223rm :
23- docker rm data-charts-api
24+ - docker rm data-charts-api
2425
2526bash :
2627 docker run --rm -it data-charts-api bash
2728
28- PID_FILE = server.pid
29-
3029test :
31- env PORT=
$(PORT ) DATABASE_URL=postgres://student:
[email protected] :5432/chartsdb
\ 32- make dev & echo $$ ! > $(PID_FILE ) && \
33- sleep 2 && \
34- uv run pytest; \
35- status=$$? ; \
36- if [ -f $( PID_FILE) ]; then kill ` cat $( PID_FILE) ` && rm $( PID_FILE) ; fi ; \
37- exit $$ status
30+ uv run pytest
3831
3932lint :
4033 uv run ruff check .
4134
42- check : test lint
35+ check : lint
Original file line number Diff line number Diff line change @@ -37,10 +37,10 @@ def get_visits():
3737 SELECT *
3838 FROM visits
3939 WHERE visits.datetime BETWEEN (%s) AND (%s);'''
40- conn = get_db ()
41- with conn .cursor (row_factory = dict_row ) as c :
42- c .execute (query , [begin_date , end_date ])
43- res = c .fetchall ()
40+ with get_db () as conn :
41+ with conn .cursor (row_factory = dict_row ) as c :
42+ c .execute (query , [begin_date , end_date ])
43+ res = c .fetchall ()
4444 return res
4545
4646
@@ -57,8 +57,8 @@ def get_registrations():
5757 SELECT *
5858 FROM registrations
5959 WHERE registrations.datetime BETWEEN (%s) AND (%s);'''
60- conn = get_db ()
61- with conn .cursor (row_factory = dict_row ) as c :
62- c .execute (query , [begin_date , end_date ])
63- res = c .fetchall ()
60+ with get_db () as conn :
61+ with conn .cursor (row_factory = dict_row ) as c :
62+ c .execute (query , [begin_date , end_date ])
63+ res = c .fetchall ()
6464 return res
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments