Hereβs a simple URL shortener implementation using Python (Flask) and SQLite. It allows users to input long URLs and get a short code they can use to redirect to the original URL.
π§ Tech Stack:
-
Python
-
Flask (web framework)
-
SQLite (lightweight database)
-
Hashlib (to create short codes)
π Project Structure:
app.py
β Main Flask Application
templates/index.html
templates/redirect.html
β How to Run
-
Save files in a folder
url_shortener/
. -
Install Flask:
pip install flask
-
Run the app:
python app.py
-
Visit
http://127.0.0.1:5000/
in your browser.
This simple tool generates a 6-character MD5-based short code for any URL and saves it in a SQLite DB. You can further enhance it with custom aliases, user auth, expiration, or analytics.
Leave a Reply