This is a Django-based API for managing a theatre system. It provides endpoints to manage theatres, plays and users, supporting actions like CRUD operations for each entity.
- Play Management: Create, update, delete, and retrieve play details.
- Performances Management: Manage performances, assign movies, and more.
- User Authentication: Handle user login, registration, and permissions.
- Dockerized: The project is Dockerized for easier deployment.
- Python 3.x
- PostgreSQL (for local setup)
- Docker (optional for containerized setup)
- Clone this repository:
git clone https://github.com/alexpanzhar/Theatre_API.git cd Theatre_API
- Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
- Install dependencies:
pip install -r requirements.txt
- Create a .env file in the project root with the following content:
echo -e "SECRET_KEY=test_secret_key\nDEBUG=True\nPOSTGRES_PASSWORD=theatre\nPOSTGRES_USER=theatre\nPOSTGRES_DB=theatre\nPOSTGRES_HOST=localhost\nPOSTGRES_PORT=5432\nPGDATA=/var/lib/postgresql/data" > .env
- Run migrations:
python manage.py migrate
- Start the development server:
python manage.py runserver
The PostgreSQL service must be locally installed and
running for the application to function correctly.
Ensure that your database container or local installation
is set up with the correct configurations specified in the .env
file before starting the project. The example can be find in example.env
- Create a .env file in the project root with the following content:
echo -e "SECRET_KEY=test_secret_key\nDEBUG=True\nPOSTGRES_PASSWORD=theatre\nPOSTGRES_USER=theatre\nPOSTGRES_DB=theatre\nPOSTGRES_HOST=db\nPOSTGRES_PORT=5432\nPGDATA=/var/lib/postgresql/data" > .env
- Build the Docker image:
docker-compose build
- Run the container:
docker-compose up
Use the following command to load prepared data from fixture:
python manage.py loaddata theatre_db_data.json
.
After loading data from fixture you can use:
- Following superuser (or create another one by yourself):
- E-mail:
[email protected]
- Password:
admin
- Following user (or create another using
api/user/register/
endpoint):
- E-mail:
[email protected]
- Password:
user_1
For getting access and refresh tokens, follow /api/user/token
endpoint
API provides different endpoints for managing Genres, Actors, Theatre Halls, Performances, Plays and Reservations.
Follow api/schema/swagger-ui/
or api/schema/redoc/
to see
and manipulate with all endpoint.
This project is licensed under the MIT License - see the LICENSE file for details.