Skip to main content

A Django app to create and manage URL shortener codes

Project description

Django URL Shortener

A reusable Django app that provides URL shortening functionality. It allows you to create short codes that redirect to longer URLs and manage them through Django's admin interface.

Features

  • Create custom codes for URLs or auto-generate random ones
  • Track usage statistics for each shortened URL
  • Full admin interface integration
  • Simple to integrate with existing Django projects

Requirements

  • Python 3.9+
  • Django 3.2+

Installation

pip install django-url-shortener

Quick start

  1. Add "url84t_shortener" to your INSTALLED_APPS setting:
INSTALLED_APPS = [
    ...
    'url84t_shortener',
]
  1. Include the url84t_shortener URLconf in your project urls.py:
from django.urls import path, include
urlpatterns = [
    ...
    path('', include('url84t_shortener.urls')),
]
  1. Run python manage.py migrate to create the necessary database tables.

  2. Start the development server and visit http://127.0.0.1:8000/admin/ to create a short URL (you'll need the Admin app enabled).

  3. Visit http://127.0.0.1:8000/code/yourcode to be redirected to the destination URL.

Usage

Creating short URLs via the admin interface

  1. Navigate to the Django admin interface
  2. Go to the "Short URLs" section
  3. Click "Add Short URL"
  4. Enter a code or leave it blank for auto-generation
  5. Enter the destination URL
  6. Save

Using in templates

You can generate links to your short URLs in templates: <a href="{% url 'url84t_shortener:redirect' 'yourcode' %}">Your short link</a>

Or using the model instance: <a href="{{ short_url.get_absolute_url }}">Your short link</a>

License

License: Coffee-1.1 Buy me a coffee Send me a bitcoin

Bitcoin address: bc1qnfv6uwpu6g6t45s3ns2xrsx4m7qulshp4g07kj

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

django_url84t_shortener-0.2.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_url84t_shortener-0.2.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file django_url84t_shortener-0.2.0.tar.gz.

File metadata

  • Download URL: django_url84t_shortener-0.2.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for django_url84t_shortener-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3861e6610a26b36b7c1885b03c14a17cdfc512fbbae2647f915b1508a1d4d425
MD5 c425e04d3acc503e27e3ee866be8c2f6
BLAKE2b-256 467a743d3f18f008856dbaf028d785d26d882fee44f5e850c5786c229e91169e

See more details on using hashes here.

File details

Details for the file django_url84t_shortener-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_url84t_shortener-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 580d3d05548e99805a7334a28ce910daab4067f101f7d13efab6c1db131096cd
MD5 f466e1c142d78f3004f7681b860f46ee
BLAKE2b-256 2239fc570d754d390f0f1d8cdb99f69b6e5cf79f4d455ce91b35533b7aa96e28

See more details on using hashes here.

Supported by

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