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.0.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for shortener-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | baffac4e5f85ec33007ac039d12849c8112c5919eacefb341fc946ac722f8859 |
|
MD5 | 01e407143a4ac17412c5fcccb00bf71d |
|
BLAKE2b-256 | 8dd0afbc7ae163a61fa9f9f5751e26d0a710625b54534e186d3f26f17f095676 |