Skip to content

Chaostreff-Potsdam/urlshortner

 
 

Repository files navigation

Flask URL-Shortener

Features

  • Shortens URLs to a default 3-digit prefix using random character and letter combination.
  • Checks if the shortened URL already exists and attempt to re-run the code-generator until it finds an available combination.
  • All data is stored in a single MySQL table.
  • Case-sensitive. The database distinguishes between upper and lower characters.
  • A Stats page lists all the shortened URLs, and shows how many times a target link has been redirected.
  • There is a button to automatically copy the shortened URL to clipboard.
  • Has an option to use Recaptcha to prevent spambots.

Setup

  • Create a virtualenv
  • Install the requirements pip install -r requirements.txt
  • Update settings.py with your own MySQL credentials
  • (Or add and edit local_settings.py, which overwrites fields in settings.py)
  • Create the database in MySQL CREATE DATABASE shortener;
  • Run python create_db.py to setup the table
  • Lastly, alter the database in MySQL to make characters case-sensitive:

ALTER DATABASE shortener CHARACTER SET utf8 COLLATE utf8_bin; ALTER TABLE url CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;

About

A lightweight, yet neat tool for shortening URLs, and keeping track of their redirects.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 46.4%
  • HTML 45.9%
  • CSS 7.7%