A Django application with Telegram integration to help users manage and track their plant cultivation activities. · Report Bug · Request Feature
Table of Contents
This Django application is designed to help users manage and track their plant cultivation activities. It includes features for cataloging plant types and varieties, tracking growth stages, and receiving recommendations for plant care operations. The application also integrates with Telegram for user interaction.
To get a local copy up and running, follow these simple steps.
- Docker installed on your machine.
- Clone the repository.
git clone https://github.com/verdiary/backend.git cd backend - Create a
.envfile in the root directory and add the following environment variables:ReplaceSECRET_KEY=your_secret_key_here BOT_TOKEN=your_bot_token_here
your_secret_key_hereandyour_bot_token_herewith your actual secret key and Telegram bot token. - Build and run the Docker containers.
docker compose up --build
- Create a superuser to access the admin interface:
docker compose exec server python manage.py createsuperuser - Access the application at
http://localhost:8000and the admin interface athttp://localhost:8000/admin.
The application can be configured using environment variables in the .env file. The following variables are supported:
SECRET_KEY: Django secret key (required)BOT_TOKEN: Telegram bot token (required)DEBUG: Enable debug mode (default: True)ALLOWED_HOSTS: List of allowed hosts (default: "localhost,127.0.0.1")DATABASE_URL: Database URL (default: sqlite:////app/db.sqlite3)LANGUAGE_CODE: Language code (default: "ru-ru")TIME_ZONE: Time zone (default: "UTC")BOT_WEBHOOK_URL: Public Telegram webhook URL (required for webhook mode)BOT_WEBHOOK_TOKEN: Telegram bot webhook token (optional, recommended for webhook mode)BOT_DROP_PENDING_UPDATES: Drop pending Telegram updates when switching mode (default: True)
Additional configuration options are available in backend/core/settings.py.
The bot can run in two modes:
- Webhook mode (
BOT_MODE=webhook, default): Django serves/bot/webhook endpoint and startup attempts to registerBOT_WEBHOOK_URLin Telegram. - Polling mode (
BOT_MODE=polling): intended primarily for local debugging and development, no public webhook URL is required, and startup removes the webhook before polling.
Examples:
# webhook mode
BOT_MODE=webhook
BOT_WEBHOOK_URL=https://example.com/bot/
BOT_WEBHOOK_TOKEN=your_secret_token
# polling mode (debug)
BOT_MODE=pollingThe Django admin interface provides a comprehensive way to manage the application's data. Administrators can:
- Manage plant catalogs, including types, varieties, growth steps, and care operations.
- Oversee user plants, their growth stages, and user profiles.
- View Telegram user information.
Access the admin interface at http://localhost:8000/admin after creating a superuser.
- Enhance Telegram bot functionality.
- Add more plant care recommendations.
- Improve user interface.
See the open issues for a full list of proposed features and known issues.
Contributions are welcome. Please fork the repository and create a pull request.
Distributed under the Apache 2.0 License. See LICENSE for more information.
Project Link: https://github.com/verdiary
- Django community for the framework.
- Windsurf for the AI assistant.
- CodeRabbitAI for the AI reviews.
- Docker for containerization.