dependency separated to 3 group main - all what need to application works dev - main deps + development libraries (black, isort, etc. ) test - main deps + testing libraries
activate poetry
poetry shell
install only main deps
poetry install
Install all dependencies.
poetry install --with dev,test
Add new deps to dev or test dependency.
poetry add <new_lib> --group=dev
It should be work in active environment
pre-commit install
in first commit it require more time for install hooks dependencies.
generate migrations
alembic revision --autogenerate -m "init"
apply migrations
alembic upgrade head
Note: out scope of docker need redefine db url
export DATABASE_URL=postgresql+asyncpg://postgres:postgres@localhost:5432/postgres
in docker
docker-compose up -d
Maybe requires
export PYTHONPATH=src
uvicorn src.main:app --reload --workers 1 --host 0.0.0.0 --port 8000
dramatiq src.worker -p 4
/auth - authentication and authorization module from auth.depednecoes Use AuthDependency - for check authorization info Use validate_permissions - for check user permission
/user - user model and routes /worker - dramatiq worker, implement task here.
about all routes can get info from
curl -X POST "http://127.0.0.1:8000/users" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "12345"
}'
curl -X POST "http://127.0.0.1:8000/auth/login" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "12345"
}'
curl -X POST "http://127.0.0.1:8000/auth/refresh" \
-H "Content-Type: application/json" \
-d '{"token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3JvbGUiOiJ1c2VyIiwidXNlcl9wayI6MSwic3ViIjoibWFpbEBleGFtcGxlLmNvbSIsImp0aSI6IjZjMDAwMzkxLTY0YTYtNDE0MS1iY2Q2LWNhZWU1YzliMDA0YyIsImlhdCI6MTcxMjAzOTQxOCwiZXhwIjoxNzEyMTI1ODE4LCJ0eXBlIjoicmVmcmVzaCJ9.FXqr2SK0E4bjLfr7qGzd1R7oO8Bp8Gak-mAFHDlR-kPZh97xuLX7Hc7raLVFQkf4-Y9EJE0TFcjVVdPQmQ_z2lcJ2R-oXNgdfO5Wpn7iz27kw-a513buDuQQdMavStSup3Ndn6qq_lljNdPcCIKRXyHzu7UU0LcX9qQcbgU4CR31MkyKiU9YFFc6e7qjPWIDAdYWJ3D0kMaRjzlWvGoBNujumXbPM8VRr2Qe1c1IWEomNCkEczvrCX9_QzzR_y6cEwgkqSTSHwVSHKSYbBx_JUy5a5GzCnsIj2e0F6MFH5SCB1z6kuyIz2V2uVmjlV6LxaWDd8fkIvbLwhCE_5rchDJ7fr0u82eQObfxdKr-gwDZPP80uBnOZo1zukE-80wh9SsPk__5bIOS79mj5WbH6eCP-qTIMWAWuAp5AC0FNd0DU9S1vCN9rTeorKR-YL9c9yEZeG2p6X2B0SEZBCKd9WdPd1JerbmWKWJFsypQ_dRxz6ozCKdp50QoNrzXhhv5wdQznBf_H2tYx23rIh2FZWRGXaGzrIqCxDjYJ1f-9JKygZHqOSbqj3T84SL4qwS97LWtXJrY02-uPi7Rx5028QdkLKXuHBiTF8dbsDRhGhvdIRAmLo5nyzLem8E98wwVoznnpspDIhk2CVQb0wxnZiE3PA3o4a_kaVctVuyiAgk"}'
curl -X GET "http://127.0.0.1:8000/users" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJwayI6MSwicm9sZSI6ImNvbW1vbiIsImV4cCI6MTcxMTc1MDU2MywidHlwZSI6ImFjY2VzcyIsImlhdCI6MTcxMTc0OTY2M30.cR88gIjZkhgWmDNFkXpx2a1xJ7gHYMEQmJrR1IhS1fyLiZw4huNTDBivY71BkvNqeEz4UYEcX18It6lb14vpwNS6Ne-ovoUP3gbThF7ueHhZtpgqM5Tliau-TLM76ppNaaDmeRNkeFNJ17lmixAxFkh8xk2E9bqs5RZPIc6CQ5ECxCCRSzs2R2KKD6YXLqKV6EYhNajir8-SWs0gIKXDnWDO5_CuTymLhDgZaEQm2LItcPm2dnubJKdHElzzzCHHzTZi7jmhYxTf22k_-ou0HFtK_2W7O0GUPlRiJ7X6GdLjabghEiXmvYYle6EeI685tR_YFR6FFz7XosKh_TQrguXSF-eOj4MghbvzWLpaUNabDdWzas7vFke2N54uivMWSYI06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