Учеба без голода! Не трать время на очереди - заказывай еду онлайн!
Install Python, copy the repo, setup the venv, install requirements and create a database:
git clone https://gitlab.crja72.ru/django/2024/spring/course/projects/team-4.git
cd team-4
python -m venv venv
source venv/bin/activate
pip install -r requirements/prod.txt
cp .env-example foosh/.env
cd foosh
python manage.py migrate
Load cities from fixtures:
python manage.py cities_light_fixtures load --base-url file:fixtures/cities_light/
Setup a test YooKassa shop. Follow the instruction: https://yookassa.ru/docs/support/merchant/payments/implement/test-store. Then, set the corresponding variables in .env file: YOOKASSA_SHOP_ID
and YOOKASSA_API_KEY
. YOOKASSA_SUCCESS_URL
is going to be your_domain/auth/profile/menu
. Also, add your domain to DJANGO_ALLOWED_HOSTS
.
Check the HTTP notifications tab. Pass the your_domain/cart/order_update/
to the URL for notifications. Enable only payment.succeeded
and payment.canceled
.
Setup Captcha.
Get your API keys here. Make sure to select V2 captcha. Set RECAPTCHA_PUBLIC_KEY
and RECAPTCHA_PRIVATE_KEY
in .env file.
Check other variables in .env file. Specify them according to your project.
Run the server:
python manage.py runserver
Setup everything like in Prod section, but install dev requirements:
pip install -r requirements/dev.txt
To use YooKassa, firstly, setup ngrok and pass the URL to DJANGO_ALLOWED_HOSTS
and DJANGO_CSRF_TRUSTED_ORIGINS
in .env file.
And have a good time!
- To dump cities, use:
python manage.py cities_light_fixtures dump
And copy result from venv/Lib/site-packages/cities_light/data/fixtures/
to fixtures/cities_light/
.
Setup everything like in Dev section, but install test requirements:
pip install -r requirements/test.txt
To run the tests:
python manage.py test
To check linting and code style (run this command from the root of the project):
flake8 .