- Management-Backend
Welcome to the Management-Backend Django project repository. This README provides you with the necessary information to set up and contribute to the development of the Management-Backend application.
Before you begin, ensure you have the following installed on your development machine:
- Python 3.11.x (only this version)
- pipenv
- Docker and Docker Compose
git clone https://github.com/RCSS-Tournament-Manager/manager-backend.git
cd management-backend
We use pipenv to manage project dependencies and virtual environments. To install the required packages, run:
python -m pip install pipenv
pipenv install --dev
This will spawn a new shell subprocess, which can be deactivated by simply closing it, or by running exit
.
python -m pipenv shell
Generate a Django secret key that will be used in your .env
file:
```sh
python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'
```
Or use **openssl**
```sh
openssl rand -hex 32
```
Create a .env
file in the root directory of the project and fill it with the necessary environment variables. Here's a template to get you started:
# Django settings
DEBUG=True
SECRET_KEY=<Your generated secret key>
ALLOWED_HOSTS=127.0.0.1,localhost
# Email settings for development
EMAIL_HOST=localhost
EMAIL_PORT=1025
EMAIL_HOST_USER=
EMAIL_HOST_PASSWORD=
EMAIL_USE_TLS=False
Replace <Your generated secret key>
with the key generated in the previous step.
We use SQLite for development purposes. To set up your database, run:
python manage.py migrate
To start the Django development server, run:
python manage.py runserver
The server will start at http://127.0.0.1:8000/
.
API document http://127.0.0.1:8000/api/docs/swagger/#/api/api_schema_retrieve
python manage.py createsuperuser
pip install tzdata
1- Mailhug (as Docker) 2- Mailpit (recommended) 3- MailTrap (External service)
The project includes a docker-compose.yml
file which sets up all the necessary services for the application, including a mail service for development purposes.
To start all services, run:
docker-compose up -d
This command will start the services in detached mode. You can view the logs for the services using:
docker-compose logs -f
To stop the services, use:
docker-compose down
the mailhug service is available at http://127.0.0.1:8025/
.
Mailpit is a small, fast, low memory, zero-dependency, multi-platform email testing tool & API for developers.
It acts as an SMTP server, provides a modern web interface to view & test captured emails, and contains an API for automated integration testing.
Mailpit was originally inspired by MailHog which is no longer maintained and hasn't seen active development for a few years now.
https://github.com/axllent/mailpit
also you can use any external service for testing smtp like mailtrap.io