Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

basics_shlyahtin_2 #5

Merged
merged 5 commits into from
Feb 25, 2025
Merged

basics_shlyahtin_2 #5

merged 5 commits into from
Feb 25, 2025

Conversation

mrekk-hub
Copy link
Collaborator

Fixes #2

@mrekk-hub mrekk-hub changed the title Add server side basics_shlyahtin_2 Feb 22, 2025
@mrekk-hub mrekk-hub added the In Review Task is ready for being checked label Feb 22, 2025
image: mongo:latest
container_name: mongodb
ports:
- "27017:27017"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это dev версия. В prod версии такого быть не должно на будущее.

- MONGO_URI=mongodb://mongodb:27017/testdb

mongodb:
image: mongo:latest
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зафиксировать версию образа для избежания потенциальных ошибок, вызванных новыми версиями.

depends_on:
- mongodb
environment:
- MONGO_URI=mongodb://mongodb:27017/testdb
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

На будущее не хардкодить, а использовать .env

def insert_data():
"""Тестовая вставка данных в коллекцию 'users'"""
users = mongo.db.users
user_id = users.insert_one({"name": "Test user", "age": 25}).inserted_id
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

С базой данных нужно работать осторожно, поэтому нужно использовать try-except

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Выглядит хорошо. Обработку ошибок, системные сообщения будем уже в main дорабатывать. Позже посмотрю с практической точки зрения.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хороший прототип с всплывающим типом. Улучшения, доработки будут вестись уже в основной программе.

@proitshnik proitshnik added In Progress Task is being completed and removed In Review Task is ready for being checked labels Feb 22, 2025
@mrekk-hub mrekk-hub requested a review from proitshnik February 23, 2025 12:44
@proitshnik proitshnik added In Review Task is ready for being checked and removed In Progress Task is being completed labels Feb 23, 2025
container_name: mongodb
restart: always
env_file:
- .env # Переменные теперь загружаются из .env
Copy link
Collaborator

@proitshnik proitshnik Feb 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Необходимо подгрузить его на GitHub

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А заливать именно .env или сделать отдельно файлик .env.sample? Я немного про это почитал, и некоторые рекомендуют подобную практику

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Поскольку мы работаем в playground, как в песочнице, то .env (.env.sample шаблон для него, чтобы вписывать чувствительные данные на месте).

@proitshnik proitshnik self-requested a review February 23, 2025 18:59
@PetrBodunov PetrBodunov merged commit 4ee83a5 into main Feb 25, 2025
1 check passed
@PetrBodunov PetrBodunov deleted the basics_shlyahtin_2 branch February 25, 2025 19:32
@proitshnik proitshnik removed the In Review Task is ready for being checked label Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Basics
3 participants