URL shortener in django
Project description
shortener
Basic URL shortener as a Django app.
To use:
- Install using pip
pip install shortener
- Include
shortener.apps.ShortenerConfig
toINSTALLED_APPS
in your project'ssettings.py
- Add the shortener to
urls.py
.- Example:
path('s/', include('shortener.urls', namespace='shortener'))
will shorten URLs tohttps://example.com/s/<ID>
.
- Example:
python manage.py migrate
- 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 aUrl
object which contains the full shortened url asUrl.shortened
, and the slug inUrl.short_id
.
Project details
Release history Release notifications | RSS feed
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 details)
Built Distribution
File details
Details for the file shortener-0.2.1.tar.gz
.
File metadata
- Download URL: shortener-0.2.1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.8.0 tqdm/4.38.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42f03bbbc2928b7db000ac92975b78b4c47fd938f258c4019a256652086a4a4d |
|
MD5 | ff1989c9805964574d37f3490e45c246 |
|
BLAKE2b-256 | 0d346e0ebac928735388128fbccab09cb6558d488e3ad4ab1af40f9a40673c8d |
File details
Details for the file shortener-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: shortener-0.2.1-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.8.0 tqdm/4.38.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b40d1309ae8cfea6132b8f10ff1d5e3e44675989f817305943cf97b492e09f72 |
|
MD5 | 80ed982c0fe511d9cfc52e7786a5f71f |
|
BLAKE2b-256 | fc4eda838c150f52155790778118c1feddeca0dfefc30527f369aaf35c70b4ef |