This project is built using Django and utilizes Celery, Celery Worker, and Celery Beat for task management. The database used is PostgreSQL, and environment variables are managed using .env files. Follow the steps below to set up and run the project successfully.
- Python 3.9 or higher
- PostgreSQL 13 or higher
- Redis (used as a broker for Celery)
virtualenv(recommended)- Git (to clone the project repository)
Download the project by running:
git clone git@github.com:anasazamov/CHECK_APPLICATION.git
cd CHECK_APPLICATIONpython3 -m venv venv
source venv/bin/activate Install the required dependencies:
pip install -r requirements.txtSet up a PostgreSQL database:
CREATE DATABASE your_db_name;
CREATE USER your_db_user WITH PASSWORD 'your_db_password';
GRANT ALL PRIVILEGES ON DATABASE your_db_name TO your_db_user;
In the root directory of the project, create a .env file and add the following variables:
DB_NAME=your_db_name
DB_USER=your_db_user
DB_PWD=your_db_password
DB_HOST=localhost
DB_PORT=5432
SECRET_KEY=your_django_secret_key
TELEGRAM_BOT_TOKEN=telegram_bot_tokenReplace your_db_name, your_db_user, your_db_password, and your_django_secret_key with your actual values.
Run the following commands to prepare the database schema:
python manage.py makemigrations
python manage.py migrateSet up an admin account for the Django admin panel:
python manage.py createsuperuserFollow the prompts to complete the setup
Start the Redis server (if not already running):
redis-serverStart the Celery Worker:
celery -A core worker --loglevel=infoStart the Celery Beat scheduler:
celery -A core beat --loglevel=infopython manage.py runserverAccess the application by opening http://127.0.0.1:8000 in your browser. Use the admin credentials you created to log in to the admin panel.
- Ensure the Redis server is running before starting Celery.
- Update DEBUG, database settings, and secret keys for production environments.
- For deployment, consider using a web server like Gunicorn or uWSGI and a reverse proxy like Nginx.