This repository contains a URL shortener service that generates and manages short URLs.
The service is optimized for performance using caching mechanisms and custom database indexing.
A Celery-based task periodically manages the availability of tokens.
Token Generation:
url
column value set to READY_TO_SET_TOKEN_URL
.READY_TO_SET_TOKEN_URL
and assigns tokens to them.URL Creation:
url
column value is READY_TO_SET_TOKEN_URL
.url
value to the desired URL.token
Field: This index allows for fast retrieval of URLs based on their tokens.url
Field: This index is applied to rows where the url
column value is READY_TO_SET_TOKEN_URL
. It optimizes the process of checking the availability of pre-generated tokens.Caching is employed to store frequently accessed URLs and tokens, reducing the load on the database and improving response times.
To install and run the URL shortener service, follow these steps:
Clone the Repository:
git clone https://github.com/ShayestehHS/DjangoUltimlateURLShortener.git
cd url-shortener
Install Dependencies:
pip install -r requirements.txt
Set Up the Database: Ensure your database is configured correctly with the necessary indexes.
Run Migrations:
python manage.py migrate
Start Celery:
celery -A your_project beat -l info
celery -A your_project worker -l info
Run the Server:
python manage.py runserver
Once the service is running, you can start shortening URLs by interacting with the provided API endpoints.
Contributions are welcome! Please fork this repository and submit a pull request with your changes.
This project is licensed under the MIT License - see the LICENSE file for details.