shortener

URL shortener in django


License
MIT
Install
pip install shortener==0.2.1

Documentation

shortener

CircleCI Coverage Status PyPi Package

Basic URL shortener as a Django app.

To use:

  1. Install using pip pip install shortener
  2. Include shortener.apps.ShortenerConfig to INSTALLED_APPS in your project's settings.py
  3. Add the shortener to urls.py.
    • Example: path('s/', include('shortener.urls', namespace='shortener')) will shorten URLs to https://example.com/s/<ID>.
  4. python manage.py migrate
  5. Either add in URL shortcuts manually through Admin, or add some hook in your project to call shortener.objects.get_or_create. The function takes in a long URL and returns a Url object which contains the full shortened url as Url.shortened, and the slug in Url.short_id.