API service for cinema management written on Django Rest Framework.
- JWT authenticated;
- Admin panel /admin/;
- Documentation is located at /api/doc/swagger/;
- Managing orders and tickets;
- Creating movies with genres, actors and image;
- Creating cinema halls;
- Adding movie sessions;
- Filtering movies and movie sessions.
Install PostgreSQL and create db for project. Then run:
git clone https://github.com/luxuriant777/cinema-api-drf.git
cd cinema-api-drf
python -m venv venv
source venv/bin/activate (Linux and macOS) or venv\Scripts\activate (Windows)
pip install -r requirements.txt
Use .env file for environment variables or set environment variables through command line.
Example:
set DB_HOST=<your db hostname>
set DB_NAME=<your db name>
set DB_USER=<your db username>
set DB_PASSWORD=<your db user password>
set DJANGO_SECRET_KEY=<your secret key>
Run migrations and run server:
python manage.py migrate
python manage.py runserver
- create user via /api/user/register/;
- get access token via /api/user/token/;
- use access token in Authorization header for all other requests.
Docker should be installed on your machine.
docker-compose build
docker-compose up
docker-compose.yml contains default values for environment variables. You can change them in docker-compose.yml or in .env file.
- Go to
127.0.0.1:8000/api/
and check project endpoints via DRF interface; - You can create new admin user: enter container
docker exec -it <container_name> bash
, and create in from there; - get access token via /api/user/token/;
- use access token in Authorization header for all other requests.