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 hashes)
Built Distribution
Close
Hashes for shortener-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b40d1309ae8cfea6132b8f10ff1d5e3e44675989f817305943cf97b492e09f72 |
|
MD5 | 80ed982c0fe511d9cfc52e7786a5f71f |
|
BLAKE2b-256 | fc4eda838c150f52155790778118c1feddeca0dfefc30527f369aaf35c70b4ef |