Skip to main content

django-shortlink

A simple Django App to hold short links mapped to long urls used in your projects.

Requirements

To use this package following needed. if not provided will be installed automatically.

Django>=2.0

Installation

Note: This package is well tested on django>=2.0. But if you are using older versions can be used with minor changes in structure.

install using pip:

$ pip install django-shortlink

Usage

Register app in settings.py

INSTALLED_APPS = [
    "django_shortlink",
]

update urls.py like below:

urlpatterns += [
    ...
    re_path(r'', include('shortlink.urls')),
    ...

Now set Setting variables, If not will use default values as below:

SHORTEN_PATH_LENGTH = 8
SHORTLINK_URL_BASE = 's/'
HOST_ADDRESS = 'http://localhost:8000'

Now to create shortlink, pass your full_url like this:

from shortlink.models import ShortLink
s = ShortLink.objects.create(full_url="https://test.com")
print(s.short_url)

short_url is the shorten url that you should give users. If they click on it, methods in views.py will be triggered and if short_url is valid, will redirect to full_url.

Metadata

Release files for django-shortlink 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-shortlink 0.0.8
File Size Uploaded Provenance Actions
django-shortlink-0.0.8.tar.gz 18.3 kB Without provenance Details for django-shortlink-0.0.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-shortlink 0.0.8
File Interpreter ABI Platform Actions
django_shortlink-0.0.8-py3-none-any.whl Python 3 none any Details for django_shortlink-0.0.8-py3-none-any.whl

Total release size: 40.8 kB

Security for django-shortlink 0.0.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page