Skip to content

Dazezh/zezh.ru

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZEZH.RU

site

ZEZH.RU is the simplest possible link shortener: paste a long URL, get a short code, share it. It also supports custom codes, multi-links, click counters, info pages, and QR codes.

The project is intentionally small and direct. Flask handles routing, Jinja renders pages, sql_queries.json keeps SQL out of Python code, and db.py provides a tiny MySQL access layer with short-lived connections and retries.

Features

  • Single short links with generated or custom codes.
  • Multi-links: one short URL that opens a list of destinations.
  • +info pages for checking where a short link leads.
  • Click counting for ordinary short links.
  • QR code generation for every resulting link.
  • Minimal responsive interface with automatic light and dark theme.

Project Structure

.
├── short.py              # Flask application and business logic
├── db.py                 # Mini ORM / database layer
├── config.json           # Local runtime configuration
├── config.example.json   # Safe configuration template
├── db_init.sql           # Database bootstrap SQL
├── sql_queries.json      # Named SQL query registry
├── templates/            # Jinja templates
└── static/               # CSS, JS, logos

Configuration

Create config.json from config.example.json and fill in your MySQL credentials.

{
  "db_config": {
    "MYSQL_HOST": "127.0.0.1",
    "MYSQL_USER": "shortener_user",
    "MYSQL_PASSWORD": "change-me",
    "MYSQL_DB": "shortener"
  },
  "SQL_QUERIES_FILE": "sql_queries.json",
  "SQL_CREATE_FILE": "db_init.sql",
  "CONFIG_FILE": "config.json",
  "MYSQL_RETRY_COUNT": 4,
  "MYSQL_RETRY_DELAY": 0.5,
  "sql_install": false
}

When sql_install is false, the database layer runs db_init.sql once, then writes the updated state back to config.json.

Run

Install the Python dependencies, prepare MySQL, then start the app:

pip install flask pymysql qrcode pillow
python short.py

By default Flask starts at:

http://127.0.0.1:5000

Notes

This is a small service by design. There are no background workers, admin panels, or heavy frameworks. The useful parts are plain: routes, templates, named SQL, and a compact DB layer.

About

Простой Flask-сервис для сокращения ссылок, создания мульти-ссылок

Topics

Resources

Stars

Watchers

Forks

Contributors