This Django web application allows users to create collections of movies they like, leveraging a third-party movie listing API. It includes functionalities for user registration, JWT authentication, and CRUD operations on movie collections. Additionally, a custom middleware tracks and counts the number of requests to the server, with APIs to view and reset the count.
- User Registration and Authentication: Users can register and authenticate using JWT tokens.
- Movie Listing: Integrates with a third-party API to list movies.
- CRUD Operations: Users can create, view, update, and delete collections of movies.
- Request Counter Middleware: A middleware to count and monitor the number of requests to the server, with APIs to view and reset the count.
- Python 3.12.4
- Django 5.1
requests
library for API integrationdjangorestframework
for building RESTful APIsdjangorestframework-simplejwt
for JWT authenticationmysqlclient
for database connectivitydjango-environ
for os environment variables
-
Clone the repository:
git clone https://github.com/yourusername/movie-collection-app.git cd movie-collection-app
-
Create a virtual environment and activate it:
python -m venv env source env/bin/activate # On Windows: env\Scripts\activate
-
Install the required packages:
pip install -r requirements.txt
-
Set up environment variables:
Create a
.env
file in the root directory and add the following:MOVIE_API_USERNAME=<username> MOVIE_API_PASSWORD=<password>
-
Apply migrations:
python manage.py migrate
-
Run the development server:
python manage.py runserver
- User Registration:
POST /register/
- Movies List:
GET /movies/
- Create Collection:
POST /collection/
- View Collection:
GET /collection/<collection_uuid>/
- Update Collection:
PUT /collection/<collection_uuid>/
- Delete Collection:
DELETE /collection/<collection_uuid>/
- Request Count:
GET /request-count/
- Reset Request Count:
POST /request-count/reset/
- Django for the web framework.
- djangorestframework for building RESTful APIs.
- Requests for HTTP requests.