Skip to main content

URL shortener in django

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shortener-0.2.1.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

shortener-0.2.1-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page