Skip to content

Repository files navigation

krtk

Basic URL shortener written in Python. Dependencies:

The word itself is a vowel-less version of kratek, meaning short in Slovenian. Also sounds like krtek which seemed cute.

Development with docker compose (recommended)

# Create/run containers (krtk flask app and postgresql database)
docker compose up

# After first startup run migrations
docker compose exec krtk flask db upgrade

Importing old link data from another shortener

See Importing from MySQL dump.

Dev environment without docker

Things are handled with pipenv:

# Install dependencies
pipenv install -d

# Go into the virtualenv
pipenv shell

# Start the app
flask run --debug


# Run type checker
pipenv run check-types

# Run formatter
pipenv run format

# Run tests
pipenv run test

Migrations

Database migrations use alembic through Flask-Migrate, refer to the official documentation.

Two everyday things you might need:

# Run any outstanding migrations (needed before first run)
flask db upgrade

# Generate new migration after modifying model in db.py
flask db migrate -m "Add field X to table Y"

About

URL shortener

Resources

Stars

0 stars

Watchers

3 watching

Forks

Used by

Contributors

Languages