A simple Django-based web application that allows users to shorten long URLs using various URL shortening services. This
project utilizes the pyshorteners library to interact with different URL shortening APIs and provides a user-friendly
interface for quick URL shortening.
Deployment: Link
- Multiple URL Shortening Services: Supports TinyURL, Bitly, Chilp.it, Clck.ru, Cutt.ly, Da.gd, and Is.gd.
- URL Validation: Ensures the provided URL is valid and not already shortened.
- Responsive Design: User-friendly interface adaptable to different screen sizes.
- Theme Toggle: Light and dark mode support with a toggle switch.
- Automatic Clipboard Copy: Click the shortened URL to copy it to your clipboard.
- Auto-clear Result: Shortened URL result disappears after 30 seconds for a cleaner interface.
(Coming Soon!)
| Light theme | Dark Theme |
|---|---|
![]() |
![]() |
- Python 3.7 or higher
- Django 3.2 or higher
pyshortenerslibrary- API keys for Bitly and Cutt.ly (if you intend to use these services)
-
Clone the repository:
git clone https://github.com/yourusername/url_shortener.git cd url_shortener -
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS or Linux:
source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
- Create a .env file in the root directory.
- Add the following variables:
SECRET_KEY=your_django_secret_key BITLY_API_KEY=your_bitly_api_key CUTLLY_API_KEY=your_cuttly_api_key
Note
If you don't have API keys for Bitly or Cutt.ly, you can leave them empty or remove related options from the application.
-
Apply migrations:
python manage.py migrate
-
Run the development server:
python manage.py runserver
-
Access the application:
Open your web browser and navigate to
http://127.0.0.1:8000/.
-
Shorten a URL:
- Enter the long URL you wish to shorten in the input field.
- Select your preferred URL shortening service from the dropdown menu.
- Click on "Shorten URL".
-
Copy Shortened URL:
- The shortened URL will be displayed.
- Click on the shortened URL to copy it to your clipboard.
- A tooltip "Copied to clipboard!" will appear upon successful copy.
-
Theme Toggle:
- Use the toggle switch in the navigation bar to switch between light and dark modes.
- Your theme preference will be remembered for future visits
url_shortener/
├── manage.py
├── requirements.txt
├── url_shortener/
│ ├── __init__.py
│ ├── asgi.py
│ ├── settings.py
│ ├── urls.py
│ ├── views.py
│ ├── wsgi.py
├── static/
│ └── url_shortener/
│ ├── fav-icon.ico
│ └── logo.png
├── templates/
│ └── home.html- Django: High-level Python web framework.
- PyShorteners: Python library for shortening URLs via various services.
- HTML5 & CSS3: For structuring and styling the web pages.
- JavaScript: For dynamic interactions on the front-end.
Contributions are welcome! If you have suggestions for improvements or would like to report a bug, please open an issue or submit a pull request.

