-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
playground/server/docker-compose.yml
Outdated
image: mongo:latest | ||
container_name: mongodb | ||
ports: | ||
- "27017:27017" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это dev версия. В prod версии такого быть не должно на будущее.
playground/server/docker-compose.yml
Outdated
- MONGO_URI=mongodb://mongodb:27017/testdb | ||
|
||
mongodb: | ||
image: mongo:latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Зафиксировать версию образа для избежания потенциальных ошибок, вызванных новыми версиями.
playground/server/docker-compose.yml
Outdated
depends_on: | ||
- mongodb | ||
environment: | ||
- MONGO_URI=mongodb://mongodb:27017/testdb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
На будущее не хардкодить, а использовать .env
playground/server/app.py
Outdated
def insert_data(): | ||
"""Тестовая вставка данных в коллекцию 'users'""" | ||
users = mongo.db.users | ||
user_id = users.insert_one({"name": "Test user", "age": 25}).inserted_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
С базой данных нужно работать осторожно, поэтому нужно использовать try-except
playground/client/popup.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Выглядит хорошо. Обработку ошибок, системные сообщения будем уже в main дорабатывать. Позже посмотрю с практической точки зрения.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Хороший прототип с всплывающим типом. Улучшения, доработки будут вестись уже в основной программе.
container_name: mongodb | ||
restart: always | ||
env_file: | ||
- .env # Переменные теперь загружаются из .env |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Необходимо подгрузить его на GitHub
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А заливать именно .env или сделать отдельно файлик .env.sample? Я немного про это почитал, и некоторые рекомендуют подобную практику
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Поскольку мы работаем в playground, как в песочнице, то .env (.env.sample шаблон для него, чтобы вписывать чувствительные данные на месте).
Fixes #2