This is a Flask-based URL shortener project that allows users to shorten long URLs into shorter ones. It's a simple and easy-to-use web application that can be hosted on any server to generate and manage shortened URLs.
URL shorteners are useful tools for converting long, cumbersome URLs into short, easily shareable links. This Flask URL shortener project provides a straightforward and customizable solution to host your own URL shortener service.
- Shorten long URLs into short, easy-to-remember links.
- Customizable settings for URL expiration.
- Statistics and analytics for shortened links, such as clicks and referrers.
- User authentication for link management (optional).
- Simple and responsive user interface.
To set up the Flask URL shortener project, follow these steps:
- Clone the repository to your local machine:
git clone https://github.com/your-username/flask-url-shortener.git
- Navigate to the project directory:
cd flask-url-shortener
- Create a virtual environment (optional but recommended):
python3 -m venv venv
- Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS and Linux:
source venv/bin/activate
- Install the required dependencies:
pip install -r requirements.txt
- Run the Flask application:
python app.py
-
Open your web browser and visit
http://localhost:5000
to access the URL shortener interface. -
Enter the long URL you want to shorten and click the "Shorten" button.
-
The application will generate a shortened URL that you can share with others.
The Flask URL shortener project can be easily customized. Below are some configuration options:
-
Database: By default, the application uses SQLite for storage. You can change the database type in the
config.py
file if needed (e.g., PostgreSQL, MySQL). -
URL Expiration: You can configure the expiration time for shortened URLs in the
config.py
file. -
User Authentication: If you want to enable user authentication for link management, follow the instructions in the
config.py
file.
Contributions to this project are welcome! If you find any issues or want to add new features, feel free to open a pull request. Please make sure to follow the coding conventions and include tests for any new functionality.
This project is licensed under the MIT License. You are free to use, modify, and distribute this code following the terms of the license.
Thank you for using the Flask URL shortener project! If you have any questions or feedback, please don't hesitate to contact us. Happy shortening!