A simple URL shortener service implemented in Django using Django Rest Framework (DRF) and documented with drf-yasg.
- Shorten long URLs into unique, easy-to-remember short codes.
- Redirect users from short URLs to their original long URLs.
- Customizable shortcode length and characters.
- Expose a RESTful API for URL shortening and redirection.
- Basic analytics for tracking the number of times a short URL is accessed.
- API documentation using Swagger/OpenAPI through
drf-yasg
.
- Python (== 3.11)
- Django (== 4.2.7)
- Django Rest Framework (== 3.14.0)
-
Clone the repository:
git clone https://github.com/mb-age/URLShortener.git
-
Navigate to the project directory:
cd webhelpers
-
Install dependencies:
pip install -r requirements.txt
-
Apply database migrations:
python manage.py migrate
API documentation is available using Swagger/OpenAPI through drf-yasg
.
-
Start the development server:
python manage.py runserver
-
Open your web browser and go to http://127.0.0.1:8000/swagger/ or http://127.0.0.1:8000/redoc/ to access the Swagger UI.
-
Explore and interact with the API using the provided documentation.
-
Start the development server:
python manage.py runserver
-
Open your web browser and go to http://127.0.0.1:8000/api/url to access the URL shortener.
-
Shorten a URL by entering it in the provided form.
-
Use the generated alias http://127.0.0.1:8000/api/url/alias to redirect to the original long URL.
-
Check the alias click count http://127.0.0.1:8000/api/url/alias/request-count
- Customize settings, such as alias length in the
settings.py
file. - Adjust API-related settings and documentation configurations in the
webhelpers/settings.py
file.