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)
| File | Size | Uploaded | |
|---|---|---|---|
| django-shortlink-0.0.8.tar.gz | 18.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_shortlink-0.0.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.8 kB
Release files / django-shortlink-0.0.8.tar.gz
| Download URL | django-shortlink-0.0.8.tar.gz |
|---|---|
| Size | 18.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
be1bbb782990ba9d31189b03ca3d2a312b603c0c7775deb4d9a9e4296e3cf266
|
|
BLAKE2b-256 checksum How to use checksums |
6f395eb3c2c7271a31cfb9e2388f6d813f9c10f6bd9b3aa7c25fb71573ac1602
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3
|
Release files / django_shortlink-0.0.8-py3-none-any.whl
| Download URL | django_shortlink-0.0.8-py3-none-any.whl |
|---|---|
| Size | 22.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
55094879e00fd187b645f70d43ae6915e8a03e4b81494ab9d95d1ed84453c380
|
|
BLAKE2b-256 checksum How to use checksums |
0cd39f1d359d16dbb45e8c633b0117e1aa7696721b6957bae3a7e0b8da7bcc12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3
|