django-link-shortener
Advanced tools
+196
| Metadata-Version: 2.1 | ||
| Name: django-link-shortener | ||
| Version: 0.5 | ||
| Summary: A simple Django Url Shortener. | ||
| Home-page: https://github.com/ronaldgrn/django-link-shortener | ||
| Author: Petronald Green | ||
| Author-email: petronaldgreen@gmail.com | ||
| License: MIT License | ||
| Keywords: url shortener,link shortener | ||
| Platform: UNKNOWN | ||
| Classifier: Development Status :: 5 - Production/Stable | ||
| Classifier: Environment :: Web Environment | ||
| Classifier: Framework :: Django | ||
| Classifier: Framework :: Django :: 2.2 | ||
| Classifier: Framework :: Django :: 3.0 | ||
| Classifier: Framework :: Django :: 3.1 | ||
| Classifier: Framework :: Django :: 3.2 | ||
| Classifier: Framework :: Django :: 4.0 | ||
| Classifier: Intended Audience :: Developers | ||
| Classifier: License :: OSI Approved :: MIT License | ||
| Classifier: Operating System :: OS Independent | ||
| Classifier: Programming Language :: Python | ||
| Classifier: Programming Language :: Python :: 3.6 | ||
| Classifier: Programming Language :: Python :: 3.7 | ||
| Classifier: Programming Language :: Python :: 3.8 | ||
| Classifier: Programming Language :: Python :: 3.9 | ||
| Classifier: Programming Language :: Python :: 3.10 | ||
| Classifier: Topic :: Internet :: WWW/HTTP | ||
| Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content | ||
| License-File: LICENSE | ||
| ===================== | ||
| django-link-shortener | ||
| ===================== | ||
| .. image:: https://github.com/ronaldgrn/django-link-shortener/actions/workflows/django-tests.yml/badge.svg | ||
| :target: https://github.com/ronaldgrn/django-link-shortener/actions/workflows/django-tests.yml | ||
| .. image:: https://img.shields.io/pypi/l/django-link-shortener.svg | ||
| :alt: PyPI - License | ||
| :target: https://pypi.org/project/django-link-shortener/ | ||
| .. image:: https://img.shields.io/pypi/v/django-link-shortener.svg | ||
| :alt: PyPI | ||
| :target: https://pypi.org/project/django-link-shortener/ | ||
| .. image:: https://coveralls.io/repos/github/ronaldgrn/django-link-shortener/badge.svg?branch=master | ||
| :target: https://coveralls.io/github/ronaldgrn/django-link-shortener?branch=master | ||
| django-link-shortener is a simple time and usage sensitive url shortening app. | ||
| Uses A-Za-z0-9 with the exception of I, i and 1. | ||
| Requires user to be logged in for link creation. | ||
| Usage | ||
| ----- | ||
| 1. pip install django-link-shortener | ||
| 2. Add '`shortener'` to your INSTALLED_APPS setting:: | ||
| INSTALLED_APPS = [ | ||
| ... | ||
| 'shortener', | ||
| ] | ||
| 3. Include `shortener.urls` in your project urls.py:: | ||
| path('s/', include('shortener.urls')), | ||
| 4. Run `python manage.py migrate` to create the shortener models. | ||
| Testing | ||
| ------- | ||
| 1. Add the following to settings | ||
| ``` | ||
| SHORTENER_ENABLE_TEST_PATH = True | ||
| ``` | ||
| 1. Start the development server and visit http://127.0.0.1:8000/s/test/<My-URL-HERE> | ||
| to create a test shortcode. | ||
| or | ||
| Use shortener.create(user, link) to generate a link via code. Use shortener.expand(link) | ||
| to revert | ||
| 6. Visit http://127.0.0.1:8000/s/<shortcode>/ to be redirected | ||
| Configuration Options | ||
| --------------------- | ||
| Place in settings.py. Each setting be overridden on a per-user basis using the admin UrlProfile section | ||
| SHORTENER_ENABLED | ||
| Default: True | ||
| Controls whether users without a shortener profile can create shortlinks. | ||
| SHORTENER_MAX_URLS | ||
| Default: -1 | ||
| Controls the default maximum limit of generated urls per account. | ||
| -1 sets infinite. | ||
| SHORTENER_MAX_CONCURRENT | ||
| Default: -1 | ||
| Controls the default maximum limit of *concurrent* (active) generated urls per account. | ||
| -1 sets infinite | ||
| SHORTENER_LIFESPAN | ||
| Default: -1 | ||
| Sets the default lifespan of links in seconds | ||
| -1 sets infinite | ||
| SHORTENER_MAX_USES | ||
| Default: -1 | ||
| Sets the default amount of times a link can be followed | ||
| -1 sets infinite | ||
| SHORTENER_LENGTH | ||
| Default: 5 | ||
| Note: Omitted from UrlProfile | ||
| Sets how many digits should be used for links. | ||
| Tries up to three times to generate a unique shortcode where | ||
| Each failure will result in length temporarily being increased by 1. | ||
| SHORTENER_ENABLE_TEST_PATH | ||
| Default: False | ||
| If true, creates shortlinks for logged in users at s/test/<<url>>/ | ||
| The response is the shortcode to use used at s/<<shortcode>> | ||
| Common Use Cases | ||
| ---------------- | ||
| goo.gl type usage (default). Unlimited concurrent links for an unlimited length of time | ||
| :: | ||
| SHORTENER_ENABLED = True | ||
| SHORTENER_MAX_URLS = -1 | ||
| SHORTENER_MAX_CONCURRENT = -1 | ||
| SHORTENER_LIFESPAN = -1 | ||
| SHORTENER_MAX_USES = -1 | ||
| Internal temporary link usage (such as on nodeferret.com). 100 Temp links per minute. 1 usage per link. | ||
| :: | ||
| SHORTENER_ENABLED = True | ||
| SHORTENER_MAX_URLS = -1 | ||
| SHORTENER_MAX_CONCURRENT = 100 # To prevent spamming | ||
| SHORTENER_LIFESPAN = 600 | ||
| SHORTENER_MAX_USES = 1 | ||
| Changelog | ||
| --------- | ||
| **v0.5** | ||
| - Replaced NullBooleanField with BooleanField (Credit: sen-den) | ||
| - Replaced travis-ci with github actions | ||
| **v0.4** | ||
| - Allow null values in UrlProfile; null fields will use global values | ||
| - str representation of UrlProfile in admin | ||
| - add user to str representation of UrlMap | ||
| - removed 256 char limit on full_url (Credit: Khaeshah) | ||
| Upgrade Instructions | ||
| -------------------- | ||
| **0.3 / 0.4 --> 0.5** | ||
| :: | ||
| pip install django-link-shortener==0.5 | ||
| python manage.py migrate | ||
+18
| shortener/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 | ||
| shortener/admin.py,sha256=4kvFNraIN6h6Lkc8UnlsNcGPWX5WuCHunX_rT7kxE_I,162 | ||
| shortener/apps.py,sha256=AxHfGHS90aZkCOlb0ZWUL4MP94yGDiSgwtKAdtWafMM,93 | ||
| shortener/models.py,sha256=2FHhEz5TtQYEMPQeTqESRsF7GjYSbAeQtTEYztejg8c,1226 | ||
| shortener/shortener.py,sha256=eVD7UuphUBRFWaH4BuaqypNsOf5RXFwcB1KIUUQic2c,3510 | ||
| shortener/tests.py,sha256=NciCsZndnGrA-PJPBLuE0qrOOLtP50S0UUP77jExO1c,7909 | ||
| shortener/urls.py,sha256=A2JsKCazqhXrBOBx9Inq8IovhTpNGa-ii4r-rY9VBVc,265 | ||
| shortener/views.py,sha256=OVcOnp7mCByewsLpt3IL2G6376MUQxovEo7-ZA8sT9I,531 | ||
| shortener/migrations/0001_initial.py,sha256=Fe8Sexd3KlA-SRs-xr2M0kClThEwJwzyvoMHblTjojU,1851 | ||
| shortener/migrations/0002_auto_20190528_1522.py,sha256=XZIBeAqIxKsg1i0ONB-ioV-H8lnsp6CHCl7gxTlQTuo,1145 | ||
| shortener/migrations/0003_auto_20190528_1558.py,sha256=wZHHGCw9tW3r8cMIzb3_KwPm2dSHvnjZygFFyYWm1uU,377 | ||
| shortener/migrations/0004_alter_urlprofile_enabled.py,sha256=sxzE66v3mEmD84rCmdpq-s9oc7oShK6Zt6AtWQcr9Ho,404 | ||
| shortener/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 | ||
| django_link_shortener-0.5.dist-info/LICENSE,sha256=llXuiNIWrY4yw0XfIHUND69bCw52JFPJN-3hECSEKmE,1071 | ||
| django_link_shortener-0.5.dist-info/METADATA,sha256=E_y3EFc7ZszwHC_YDFSz10S1PWJy0WFvdsY5djQqtds,5111 | ||
| django_link_shortener-0.5.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92 | ||
| django_link_shortener-0.5.dist-info/top_level.txt,sha256=8fVZ-e_NjbMpSyO0G89mqIAHW-uQ6GeoU9HPaEkWukw,10 | ||
| django_link_shortener-0.5.dist-info/RECORD,, |
| # Generated by Django 4.0 on 2021-12-21 20:37 | ||
| from django.db import migrations, models | ||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ('shortener', '0003_auto_20190528_1558'), | ||
| ] | ||
| operations = [ | ||
| migrations.AlterField( | ||
| model_name='urlprofile', | ||
| name='enabled', | ||
| field=models.BooleanField(default=True, null=True), | ||
| ), | ||
| ] |
| shortener |
+5
| Wheel-Version: 1.0 | ||
| Generator: bdist_wheel (0.37.1) | ||
| Root-Is-Purelib: true | ||
| Tag: py3-none-any | ||
@@ -23,3 +23,3 @@ from django.db import models | ||
| user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) | ||
| enabled = models.NullBooleanField(default=True, null=True) | ||
| enabled = models.BooleanField(default=True, null=True) | ||
| max_urls = models.IntegerField(default=-1, null=True, blank=True) | ||
@@ -26,0 +26,0 @@ max_concurrent_urls = models.IntegerField(default=100, null=True, blank=True) |
| Metadata-Version: 1.1 | ||
| Name: django-link-shortener | ||
| Version: 0.4 | ||
| Summary: A simple Django Url Shortener. | ||
| Home-page: https://github.com/ronaldgrn/django-link-shortener | ||
| Author: Petronald Green | ||
| Author-email: petronaldgreen@gmail.com | ||
| License: MIT License | ||
| Description: ===================== | ||
| django-link-shortener | ||
| ===================== | ||
| .. image:: https://travis-ci.org/ronaldgrn/django-link-shortener.svg?branch=master | ||
| :target: https://travis-ci.org/ronaldgrn/django-link-shortener | ||
| .. image:: https://img.shields.io/pypi/l/django-link-shortener.svg | ||
| :alt: PyPI - License | ||
| :target: https://pypi.org/project/django-link-shortener/ | ||
| .. image:: https://img.shields.io/pypi/v/django-link-shortener.svg | ||
| :alt: PyPI | ||
| :target: https://pypi.org/project/django-link-shortener/ | ||
| .. image:: https://coveralls.io/repos/github/ronaldgrn/django-link-shortener/badge.svg?branch=master | ||
| :target: https://coveralls.io/github/ronaldgrn/django-link-shortener?branch=master | ||
| django-link-shortener is a simple time and usage sensitive url shortening app. | ||
| Uses A-Za-z0-9 with the exception of I, i and 1. | ||
| Requires user to be logged in for link creation. | ||
| Usage | ||
| ----- | ||
| 1. pip install django-link-shortener | ||
| 2. Add "shortener" to your INSTALLED_APPS setting like this:: | ||
| INSTALLED_APPS = [ | ||
| ... | ||
| 'shortener', | ||
| ] | ||
| 3. Include the polls URLconf in your project urls.py like this:: | ||
| path('s/', include('shortener.urls')), | ||
| 4. Run `python manage.py migrate` to create the shortener models. | ||
| Testing | ||
| ------- | ||
| 1. Add the following to settings | ||
| ``` | ||
| SHORTENER_ENABLE_TEST_PATH = True | ||
| ``` | ||
| 1. Start the development server and visit http://127.0.0.1:8000/s/test/<My-URL-HERE> | ||
| to create a test shortcode. | ||
| or | ||
| Use shortener.create(user, link) to generate a link via code. Use shortener.expand(link) | ||
| to revert | ||
| 6. Visit http://127.0.0.1:8000/s/<shortcode>/ to be redirected | ||
| Configuration Options | ||
| --------------------- | ||
| Place in settings.py. Each setting be overridden on a per-user basis using the admin UrlProfile section | ||
| SHORTENER_ENABLED | ||
| Default: True | ||
| Controls whether users without a shortener profile can create shortlinks. | ||
| SHORTENER_MAX_URLS | ||
| Default: -1 | ||
| Controls the default maximum limit of generated urls per account. | ||
| -1 sets infinite. | ||
| SHORTENER_MAX_CONCURRENT | ||
| Default: -1 | ||
| Controls the default maximum limit of *concurrent* (active) generated urls per account. | ||
| -1 sets infinite | ||
| SHORTENER_LIFESPAN | ||
| Default: -1 | ||
| Sets the default lifespan of links in seconds | ||
| -1 sets infinite | ||
| SHORTENER_MAX_USES | ||
| Default: -1 | ||
| Sets the default amount of times a link can be followed | ||
| -1 sets infinite | ||
| SHORTENER_LENGTH | ||
| Default: 5 | ||
| Note: Omitted from UrlProfile | ||
| Sets how many digits should be used for links. | ||
| Tries up to three times to generate a unique shortcode where | ||
| Each failure will result in length temporaily being increased by 1. | ||
| SHORTENER_ENABLE_TEST_PATH | ||
| Default: False | ||
| If true, creates shortlinks for logged in users at s/test/<<url>>/ | ||
| The response is the shortcode to use used at s/<<shortcode>> | ||
| Common Use Cases | ||
| ---------------- | ||
| goo.gl type usage (default). Unlimited concurrent links for an unlimited length of time | ||
| :: | ||
| SHORTENER_ENABLED = True | ||
| SHORTENER_MAX_URLS = -1 | ||
| SHORTENER_MAX_CONCURRENT = -1 | ||
| SHORTENER_LIFESPAN = -1 | ||
| SHORTENER_MAX_USES = -1 | ||
| Internal temporary link usage (such as on nodeferret.com). 100 Temp links per minute. 1 usage per link. | ||
| :: | ||
| SHORTENER_ENABLED = True | ||
| SHORTENER_MAX_URLS = -1 | ||
| SHORTENER_MAX_CONCURRENT = 100 # To prevent spamming | ||
| SHORTENER_LIFESPAN = 600 | ||
| SHORTENER_MAX_USES = 1 | ||
| Changelog | ||
| --------- | ||
| **v0.4** | ||
| - Allow null values in UrlProfile; null fields will use global values | ||
| - str representation of UrlProfile in admin | ||
| - add user to str representation of UrlMap | ||
| - removed 256 char limit on full_url (Credit: Khaeshah) | ||
| Upgrade Instructions | ||
| -------------------- | ||
| **0.3 -> 0.4** | ||
| :: | ||
| pip install django-link-shortener==0.4 | ||
| python manage.py migrate | ||
| Keywords: url shortener,link shortener | ||
| Platform: UNKNOWN | ||
| Classifier: Environment :: Web Environment | ||
| Classifier: Framework :: Django | ||
| Classifier: Framework :: Django :: 2.0 | ||
| Classifier: Intended Audience :: Developers | ||
| Classifier: License :: OSI Approved :: MIT License | ||
| Classifier: Operating System :: OS Independent | ||
| Classifier: Programming Language :: Python | ||
| Classifier: Programming Language :: Python :: 3.5 | ||
| Classifier: Programming Language :: Python :: 3.6 | ||
| Classifier: Topic :: Internet :: WWW/HTTP | ||
| Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content |
| LICENSE | ||
| MANIFEST.in | ||
| README.rst | ||
| setup.py | ||
| django_link_shortener.egg-info/PKG-INFO | ||
| django_link_shortener.egg-info/SOURCES.txt | ||
| django_link_shortener.egg-info/dependency_links.txt | ||
| django_link_shortener.egg-info/top_level.txt | ||
| shortener/__init__.py | ||
| shortener/admin.py | ||
| shortener/apps.py | ||
| shortener/models.py | ||
| shortener/shortener.py | ||
| shortener/tests.py | ||
| shortener/urls.py | ||
| shortener/views.py | ||
| shortener/migrations/0001_initial.py | ||
| shortener/migrations/0002_auto_20190528_1522.py | ||
| shortener/migrations/0003_auto_20190528_1558.py | ||
| shortener/migrations/__init__.py |
| shortener |
| include LICENSE | ||
| include README.rst | ||
| recursive-include shortener/migrations *.py |
-177
| Metadata-Version: 1.1 | ||
| Name: django-link-shortener | ||
| Version: 0.4 | ||
| Summary: A simple Django Url Shortener. | ||
| Home-page: https://github.com/ronaldgrn/django-link-shortener | ||
| Author: Petronald Green | ||
| Author-email: petronaldgreen@gmail.com | ||
| License: MIT License | ||
| Description: ===================== | ||
| django-link-shortener | ||
| ===================== | ||
| .. image:: https://travis-ci.org/ronaldgrn/django-link-shortener.svg?branch=master | ||
| :target: https://travis-ci.org/ronaldgrn/django-link-shortener | ||
| .. image:: https://img.shields.io/pypi/l/django-link-shortener.svg | ||
| :alt: PyPI - License | ||
| :target: https://pypi.org/project/django-link-shortener/ | ||
| .. image:: https://img.shields.io/pypi/v/django-link-shortener.svg | ||
| :alt: PyPI | ||
| :target: https://pypi.org/project/django-link-shortener/ | ||
| .. image:: https://coveralls.io/repos/github/ronaldgrn/django-link-shortener/badge.svg?branch=master | ||
| :target: https://coveralls.io/github/ronaldgrn/django-link-shortener?branch=master | ||
| django-link-shortener is a simple time and usage sensitive url shortening app. | ||
| Uses A-Za-z0-9 with the exception of I, i and 1. | ||
| Requires user to be logged in for link creation. | ||
| Usage | ||
| ----- | ||
| 1. pip install django-link-shortener | ||
| 2. Add "shortener" to your INSTALLED_APPS setting like this:: | ||
| INSTALLED_APPS = [ | ||
| ... | ||
| 'shortener', | ||
| ] | ||
| 3. Include the polls URLconf in your project urls.py like this:: | ||
| path('s/', include('shortener.urls')), | ||
| 4. Run `python manage.py migrate` to create the shortener models. | ||
| Testing | ||
| ------- | ||
| 1. Add the following to settings | ||
| ``` | ||
| SHORTENER_ENABLE_TEST_PATH = True | ||
| ``` | ||
| 1. Start the development server and visit http://127.0.0.1:8000/s/test/<My-URL-HERE> | ||
| to create a test shortcode. | ||
| or | ||
| Use shortener.create(user, link) to generate a link via code. Use shortener.expand(link) | ||
| to revert | ||
| 6. Visit http://127.0.0.1:8000/s/<shortcode>/ to be redirected | ||
| Configuration Options | ||
| --------------------- | ||
| Place in settings.py. Each setting be overridden on a per-user basis using the admin UrlProfile section | ||
| SHORTENER_ENABLED | ||
| Default: True | ||
| Controls whether users without a shortener profile can create shortlinks. | ||
| SHORTENER_MAX_URLS | ||
| Default: -1 | ||
| Controls the default maximum limit of generated urls per account. | ||
| -1 sets infinite. | ||
| SHORTENER_MAX_CONCURRENT | ||
| Default: -1 | ||
| Controls the default maximum limit of *concurrent* (active) generated urls per account. | ||
| -1 sets infinite | ||
| SHORTENER_LIFESPAN | ||
| Default: -1 | ||
| Sets the default lifespan of links in seconds | ||
| -1 sets infinite | ||
| SHORTENER_MAX_USES | ||
| Default: -1 | ||
| Sets the default amount of times a link can be followed | ||
| -1 sets infinite | ||
| SHORTENER_LENGTH | ||
| Default: 5 | ||
| Note: Omitted from UrlProfile | ||
| Sets how many digits should be used for links. | ||
| Tries up to three times to generate a unique shortcode where | ||
| Each failure will result in length temporaily being increased by 1. | ||
| SHORTENER_ENABLE_TEST_PATH | ||
| Default: False | ||
| If true, creates shortlinks for logged in users at s/test/<<url>>/ | ||
| The response is the shortcode to use used at s/<<shortcode>> | ||
| Common Use Cases | ||
| ---------------- | ||
| goo.gl type usage (default). Unlimited concurrent links for an unlimited length of time | ||
| :: | ||
| SHORTENER_ENABLED = True | ||
| SHORTENER_MAX_URLS = -1 | ||
| SHORTENER_MAX_CONCURRENT = -1 | ||
| SHORTENER_LIFESPAN = -1 | ||
| SHORTENER_MAX_USES = -1 | ||
| Internal temporary link usage (such as on nodeferret.com). 100 Temp links per minute. 1 usage per link. | ||
| :: | ||
| SHORTENER_ENABLED = True | ||
| SHORTENER_MAX_URLS = -1 | ||
| SHORTENER_MAX_CONCURRENT = 100 # To prevent spamming | ||
| SHORTENER_LIFESPAN = 600 | ||
| SHORTENER_MAX_USES = 1 | ||
| Changelog | ||
| --------- | ||
| **v0.4** | ||
| - Allow null values in UrlProfile; null fields will use global values | ||
| - str representation of UrlProfile in admin | ||
| - add user to str representation of UrlMap | ||
| - removed 256 char limit on full_url (Credit: Khaeshah) | ||
| Upgrade Instructions | ||
| -------------------- | ||
| **0.3 -> 0.4** | ||
| :: | ||
| pip install django-link-shortener==0.4 | ||
| python manage.py migrate | ||
| Keywords: url shortener,link shortener | ||
| Platform: UNKNOWN | ||
| Classifier: Environment :: Web Environment | ||
| Classifier: Framework :: Django | ||
| Classifier: Framework :: Django :: 2.0 | ||
| Classifier: Intended Audience :: Developers | ||
| Classifier: License :: OSI Approved :: MIT License | ||
| Classifier: Operating System :: OS Independent | ||
| Classifier: Programming Language :: Python | ||
| Classifier: Programming Language :: Python :: 3.5 | ||
| Classifier: Programming Language :: Python :: 3.6 | ||
| Classifier: Topic :: Internet :: WWW/HTTP | ||
| Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content |
-156
| ===================== | ||
| django-link-shortener | ||
| ===================== | ||
| .. image:: https://travis-ci.org/ronaldgrn/django-link-shortener.svg?branch=master | ||
| :target: https://travis-ci.org/ronaldgrn/django-link-shortener | ||
| .. image:: https://img.shields.io/pypi/l/django-link-shortener.svg | ||
| :alt: PyPI - License | ||
| :target: https://pypi.org/project/django-link-shortener/ | ||
| .. image:: https://img.shields.io/pypi/v/django-link-shortener.svg | ||
| :alt: PyPI | ||
| :target: https://pypi.org/project/django-link-shortener/ | ||
| .. image:: https://coveralls.io/repos/github/ronaldgrn/django-link-shortener/badge.svg?branch=master | ||
| :target: https://coveralls.io/github/ronaldgrn/django-link-shortener?branch=master | ||
| django-link-shortener is a simple time and usage sensitive url shortening app. | ||
| Uses A-Za-z0-9 with the exception of I, i and 1. | ||
| Requires user to be logged in for link creation. | ||
| Usage | ||
| ----- | ||
| 1. pip install django-link-shortener | ||
| 2. Add "shortener" to your INSTALLED_APPS setting like this:: | ||
| INSTALLED_APPS = [ | ||
| ... | ||
| 'shortener', | ||
| ] | ||
| 3. Include the polls URLconf in your project urls.py like this:: | ||
| path('s/', include('shortener.urls')), | ||
| 4. Run `python manage.py migrate` to create the shortener models. | ||
| Testing | ||
| ------- | ||
| 1. Add the following to settings | ||
| ``` | ||
| SHORTENER_ENABLE_TEST_PATH = True | ||
| ``` | ||
| 1. Start the development server and visit http://127.0.0.1:8000/s/test/<My-URL-HERE> | ||
| to create a test shortcode. | ||
| or | ||
| Use shortener.create(user, link) to generate a link via code. Use shortener.expand(link) | ||
| to revert | ||
| 6. Visit http://127.0.0.1:8000/s/<shortcode>/ to be redirected | ||
| Configuration Options | ||
| --------------------- | ||
| Place in settings.py. Each setting be overridden on a per-user basis using the admin UrlProfile section | ||
| SHORTENER_ENABLED | ||
| Default: True | ||
| Controls whether users without a shortener profile can create shortlinks. | ||
| SHORTENER_MAX_URLS | ||
| Default: -1 | ||
| Controls the default maximum limit of generated urls per account. | ||
| -1 sets infinite. | ||
| SHORTENER_MAX_CONCURRENT | ||
| Default: -1 | ||
| Controls the default maximum limit of *concurrent* (active) generated urls per account. | ||
| -1 sets infinite | ||
| SHORTENER_LIFESPAN | ||
| Default: -1 | ||
| Sets the default lifespan of links in seconds | ||
| -1 sets infinite | ||
| SHORTENER_MAX_USES | ||
| Default: -1 | ||
| Sets the default amount of times a link can be followed | ||
| -1 sets infinite | ||
| SHORTENER_LENGTH | ||
| Default: 5 | ||
| Note: Omitted from UrlProfile | ||
| Sets how many digits should be used for links. | ||
| Tries up to three times to generate a unique shortcode where | ||
| Each failure will result in length temporaily being increased by 1. | ||
| SHORTENER_ENABLE_TEST_PATH | ||
| Default: False | ||
| If true, creates shortlinks for logged in users at s/test/<<url>>/ | ||
| The response is the shortcode to use used at s/<<shortcode>> | ||
| Common Use Cases | ||
| ---------------- | ||
| goo.gl type usage (default). Unlimited concurrent links for an unlimited length of time | ||
| :: | ||
| SHORTENER_ENABLED = True | ||
| SHORTENER_MAX_URLS = -1 | ||
| SHORTENER_MAX_CONCURRENT = -1 | ||
| SHORTENER_LIFESPAN = -1 | ||
| SHORTENER_MAX_USES = -1 | ||
| Internal temporary link usage (such as on nodeferret.com). 100 Temp links per minute. 1 usage per link. | ||
| :: | ||
| SHORTENER_ENABLED = True | ||
| SHORTENER_MAX_URLS = -1 | ||
| SHORTENER_MAX_CONCURRENT = 100 # To prevent spamming | ||
| SHORTENER_LIFESPAN = 600 | ||
| SHORTENER_MAX_USES = 1 | ||
| Changelog | ||
| --------- | ||
| **v0.4** | ||
| - Allow null values in UrlProfile; null fields will use global values | ||
| - str representation of UrlProfile in admin | ||
| - add user to str representation of UrlMap | ||
| - removed 256 char limit on full_url (Credit: Khaeshah) | ||
| Upgrade Instructions | ||
| -------------------- | ||
| **0.3 -> 0.4** | ||
| :: | ||
| pip install django-link-shortener==0.4 | ||
| python manage.py migrate |
| [egg_info] | ||
| tag_build = | ||
| tag_date = 0 | ||
-35
| import os | ||
| from setuptools import find_packages, setup | ||
| with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme: | ||
| README = readme.read() | ||
| # allow setup.py to be run from any path | ||
| os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) | ||
| setup( | ||
| name='django-link-shortener', | ||
| version='0.4', | ||
| packages=['shortener'], | ||
| include_package_data=True, | ||
| license='MIT License', | ||
| description='A simple Django Url Shortener.', | ||
| long_description=README, | ||
| url='https://github.com/ronaldgrn/django-link-shortener', | ||
| author='Petronald Green', | ||
| author_email='petronaldgreen@gmail.com', | ||
| keywords=['url shortener', 'link shortener'], | ||
| classifiers=[ | ||
| 'Environment :: Web Environment', | ||
| 'Framework :: Django', | ||
| 'Framework :: Django :: 2.0', | ||
| 'Intended Audience :: Developers', | ||
| 'License :: OSI Approved :: MIT License', | ||
| 'Operating System :: OS Independent', | ||
| 'Programming Language :: Python', | ||
| 'Programming Language :: Python :: 3.5', | ||
| 'Programming Language :: Python :: 3.6', | ||
| 'Topic :: Internet :: WWW/HTTP', | ||
| 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', | ||
| ], | ||
| ) |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
0
-100%0
-100%0
-100%