Saravanan666/pypi-org huggingface dataset:
Package: django-recurrences
NOTE: This is not stable yet and will likely change!  Please don’t use in
production until the 1.0 release.Possible name change to: django-recurrencesdjango-recurrencedjango-recurrence is a python recurrence module written for django.IntallationDownload the source from Github and runpython setup.py install.DependenciesTODOExamplesTODOTestsFrom the test directory where the manage.py file is, run:python manage.py test
Package: django-recyclebin
=====
Django RecyclebinDjango Recyclebin is a Django app to create recyclebin functionality in your project. you will be able to temporarily delete, restore and permanently delete data.Quick startAdd "recyclebin" to your INSTALLED_APPS setting like this::INSTALLED_APPS = [
...
'recyclebin',
]import SoftDeleteMixin ''from recyclebin.models import SoftDeleteMixin''Inherit your model with SoftDeleteMixin``class Mymodel(SoftDeleteMixin)``Runpython manage.py makemigrationsandpython manage.py migrate.import recyclebin functionsfrom recyclebin.functions import get_deleted_items, restore, permanent_deleteHow to temporarily delete.
you don't need to do anything. after inheriting your model with SoftDeleteMixin. your regular .delete() method will temporarily delete objectsHow to view deleted items
create a list of models
from myapp.models import Model1, Model2, Model3...
li = [Model1, Model2, Model3...]get_deleted_items(li)''This function will return serialized response that will contain model_name, name, pk, deleted_by, deleted_at''YOUR MODEL MUST HAVE NAME FIELD OTHERWISE NONE WILL BE RETURNED INSTEAD OF NAMEHow to restore
pass restore function model name and id. model name must be string and id an integerrestore(model1, 1)How to permanently delete
pass permanent_delete function model name and id. model name must be string and id an integerpermanent_delete(model1, 1)
Package: django-redactor-2.0
# django-wysiwyg-redactorUpdated to work with django 2.0.x(Version modified of django-redactorjs)Some changes:* version of plugin redactorjs 7.6.3 (changes the [license](#license) too)* new API method `$('#redactor').getSelection()` get the selected content in editor* new API method `$('#redactor').getSettings()` you can get and set settings anytime you want* removing some ajax calls, (modal windows), to avoid the crossdomain issue on production env* with the *extra_script* option/setting you can load some script to do something more after load the redactor* now the redactor toolbar is more responsive* fixing some bugs, adapting things...## Screenshot<img src="https://raw.github.com/douglasmiranda/django-wysiwyg-redactor/master/static/img/screenshot.png">What's that-----------*django-wysiwyg-redactor is a reusable application for Django, using WYSIWYG editor http://redactorjs.com/*Dependence------------ `Django >= 1.3` # for static files- `PIL` # for image uploadGetting started---------------* Install django-wysiwyg-redactor:```pip install django-wysiwyg-redactor```* Add `'redactor'` to INSTALLED_APPS.* Add `url(r'^redactor/', include('redactor.urls'))`, to urls.py* Add default config in settings.py (more settings see: <https://github.com/douglasmiranda/django-wysiwyg-redactor/wiki/Settings>):```pythonREDACTOR_OPTIONS = {'lang': 'en'}REDACTOR_UPLOAD = 'uploads/'```Using in model--------------```pythonfrom django.db import modelsfrom redactor.fields import RedactorFieldclass Entry(models.Model):title = models.CharField(max_length=250, verbose_name=u'Title')short_text = RedactorField(verbose_name=u'Text')```or use custom parametrs:```pythonshort_text = RedactorField(verbose_name=u'Text',redactor_options={'lang': 'en', 'focus': 'true'},upload_to='tmp/')```Using for only admin interface-----------------------------```pythonfrom django import formsfrom redactor.widgets import RedactorEditorfrom blog.models import Entryclass EntryAdminForm(forms.ModelForm):class Meta:model = Entrywidgets = {'short_text': RedactorEditor(),}class EntryAdmin(admin.ModelAdmin):form = EntryAdminForm````RedactorEditor` takes the same parameters as `RedactorField`## LicenseStarting with version 7.6.3 redactor-js is licensed under [Creative Commons Attribution-NonCommercial 3.0 license](http://creativecommons.org/licenses/by-nc/3.0/)For commercial use please buy license here: http://redactorjs.com/download/ or use earlier version.
Package: django-redactorjs
django-redactorjs===============http://github.com/TigorC/django-redactorjsWhat's that-----------*django-redactorjs is a reusable application for Django, using WYSIWYG editor http://redactorjs.com/***Package not compatible with previous version 0.2.x.****Package not include redactor.js**Dependence------------ `Django >= 1.3` # for static files- `Pillow` or `PIL` # for image uploadGetting started---------------* Install django-redactorjs:``pip install django-redactorjs``* Add `'redactor'` to INSTALLED_APPS.* Add `url(r'^redactor/', include('redactor.urls'))`, to urls.py* Add default config in settings.py (more settings see: <http://imperavi.com/redactor/docs/settings/>):```REDACTOR_OPTIONS = {'lang': 'ru'}REDACTOR_UPLOAD = 'uploads/'```Config for redactor static```REDACTOR_CSS = {'all': ('imperavi/css/redactor.css',)}REDACTOR_JS = ['http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js','imperavi/js/redactor.js','imperavi/js/ru.js',]```You can also specify a function to modify the filename of uploaded files (for example to ensure the filename is unique).```import uuiddef make_unique_filename(filename):ext = filename.split('.')[-1]return "%s.%s" % (uuid.uuid4(), ext)REDACTOR_GENERATE_FILENAME = make_unique_filename```Using in model--------------from django.db import modelsfrom redactor.fields import RedactorFieldclass Entry(models.Model):title = models.CharField(max_length=250, verbose_name=u'Заголовок')short_text = RedactorField(verbose_name=u'Краткий текст')or use custom parametrs:short_text = RedactorField(verbose_name=u'Краткий текст',redactor_options={'lang': 'ru', 'focus': 'true'},upload_to='tmp/')Using for only admin interface-----------------------------from django import formsfrom redactor.widgets import RedactorEditorfrom blog.models import Entryclass EntryAdminForm(forms.ModelForm):class Meta:model = Entrywidgets = {'short_text': RedactorEditor(),}class EntryAdmin(admin.ModelAdmin):form = EntryAdminForm`RedactorEditor` takes the same parameters as `RedactorField`
Package: django-redbeat
django-redbeat is an app based on celery-redbeat with model based celery periodic tasks.Quick startAdd “django_redbeat” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'django_redbeat',
]Runpython manage.py migrateto create the PeriodicTaskeEntry model.Start the development server and visithttp://127.0.0.1:8000/admin/to create a periodic task (you’ll need the Admin app enabled).Visithttp://127.0.0.1:8000/admin/django_redbeat/periodictasksentry/to add periodic task.Sample code to use:from django_redbeat import PeriodicTaskEntry

task = PeriodicTasksEntry.objects.create(
   name="The verbose name of the task",
   task="yourapp.tasks.task_name",
   args=[arg1, arg2,],
   schedule=10# the schedule in seconds
)
Package: django-redirect-middleware
Adddjango.contrib.redirectsto INSTALLED_APPSINSTALLED_APPS = [
    ...
        'django.contrib.redirects',
    ...
]Addredirects.middleware.RedirectMiddlewareto MIDDLEWARE_CLASSESMIDDLEWARE_CLASSES = [
        ...
        'redirects.middleware.RedirectMiddleware',
        ...
]Synchronize your database models rundjango syncdb
Package: django-redirector
Built for use on grovemade.com, Django Redirector adds simple admin powered 301 redirects.Example rules:Path:/foo/bar/Type:exact (case insensitive)Path:/products/Type:startswithUses caching heavily because the middleware is called on every request.redirect rules are cached onceredirect results are cached per request pathCache is invalidated when a new rule is saved/added.InstallationAdd the package to your python path, pip install, setup.py install, etc.Add‘django_redirects’toINSTALLED_APPSAdd‘django_redirects.middleware.RedirectMiddleware’immediately afterCommonMiddlewareinMIDDLEWARE_CLASSESSyncdb, then navigate to your admin panel!SettingsREDIRECT_CACHE_TIME: _default: 60*30_
Seconds to cache individual page redirect results.
Package: django-redirect-plus
Django's built-in redirect app with some extras added.============Based on Django's built-in redirect app with some extras added.Starting point for this app was https://github.com/django/django/tree/master/django/contrib/redirects. Now with these extra features:* Simple hit counter on each redirect ruleInstallation------------To get the latest stable release from PyPipip install django-redirect-plusTo get the latest commit from GitHubpip install -e git+git://github.com/arteria/django-redirect-plus.git#egg=redirect_plusAdd ``redirect_plus`` to your ``INSTALLED_APPS``INSTALLED_APPS = (...,'django.contrib.redirects','redirect_plus',)Update your ``MIDDLEWARE_CLASSES`` in your project settingsMIDDLEWARE_CLASSES = (...# 'django.contrib.redirects.middleware.RedirectFallbackMiddleware' , # <= comment this'redirect_plus.middleware.RedirectFallbackMiddleware', # <= replace by /add this middleware...)Don't forget to sync your database./manage.py syncdb
Package: django-redirects
django-redirectsdjango-redirectsfills the gap ofdjango.contrib.redirectsofferingredirects with full control.FeaturesSites framework support.Custom redirect type:301,302,303,307,308.Custom redirect match condition:EXACT,PREFIXorREGEX.Regex support, match and replace groups using group reference:$1,$2,$3, ...Counter to monitor requests count handled by each redirect.Admin integration with list filters and the possibility to test the redirect.InstallationRunpip install django-redirects.Addredirectstosettings.INSTALLED_APPS.Addredirects.middleware.RedirectMiddlewaretosettings.MIDDLEWAREbefore other middlewares.Runpython manage.py migrate.Restart your application server.Testing# clone repositorygitclonehttps://github.com/fabiocaccamo/django-redirects.git&&cddjango-redirects# create virtualenv and activate itpython-mvenvvenv&&.venv/bin/activate# upgrade pippython-mpipinstall--upgradepip# install requirementspipinstall-rrequirements.txt-rrequirements-test.txt# install pre-commit to run formatters and linterspre-commitinstall--install-hooks# run teststox# orpythonruntests.py# orpython-mdjangotest--settings"tests.settings"LicenseReleased underMIT License.Supporting:star: Star this project onGitHub:octocat: Follow me onGitHub:blue_heart: Follow me onTwitter:moneybag: Sponsor me onGithubSee alsodjango-admin-interface- the default admin interface made customizable by the admin itself. popup windows replaced by modals. 🧙 ⚡django-colorfield- simple color field for models with a nice color-picker in the admin. 🎨django-extra-settings- config and manage typed extra settings using just the django admin. ⚙️django-maintenance-mode- shows a 503 error page when maintenance-mode is on. 🚧 🛠️django-treenode- probably the best abstract model / admin for your tree based stuff. 🌳python-benedict- dict subclass with keylist/keypath support, I/O shortcuts (base64, csv, json, pickle, plist, query-string, toml, xml, yaml) and many utilities. 📘python-codicefiscale- encode/decode Italian fiscal codes - codifica/decodifica del Codice Fiscale. 🇮🇹 💳python-fontbro- friendly font operations. 🧢python-fsutil- file-system utilities for lazy devs. 🧟‍♂️
Package: django-redirects-file
UsageImport this in urls.py and assign it to urlpatterns
BEFORE custom urls. (redirects should be hit first)
e.g:fromdjango_redirects_fileimportload_redirectsurlpatterns=load_redirects()urlpatterns+=patterns('',url(r'^(?P<template>.*)/?$',TemplateFinder.as_view()),)Format of redirects.jsonThe json format is simply key/value pairs, from source to destination:{"getubuntu/download_static":"http://www.ubuntu.com/netbook/get-ubuntu/download","testing/quantal/alpha1":"https://wiki.ubuntu.com/QuantalQuetzal/TechnicalOverview/Alpha1"}To convert old “double spaced” redirects.txt:json.dumps(dict([i.split('  ')[0:2]#ignore the 3rd item, in-line commentsforiinopen('/path/to/redirects.txt').readlines()iflen(i.split('  '))>=2#ignore whole comment lines]))
Package: django-redirect-to-non-www
django-redirect-to-non-wwwRedirects www URL address to non-www.Installationpipinstalldjango-redirect-to-non-wwwpipinstallgit+https://git@github.com/lukasvinclav/django-redirect-to-non-www.gitConfigurationOpen your settings file and append middlewareredirect_to_non_www.middleware.RedirectToNonWwwat the end ofMIDDLEWARElist.MIDDLEWARE=[# Other middleware classes'redirect_to_non_www.middleware.RedirectToNonWww',]
Package: django-redis-aiogram
django-redis-aiogramdjango-redis-aiogramprovides a quick way to installaiogramin a container adjacent todjango, allowing you to use your own router and loop. Also allows you to send messages throughredis.InstallationThe easiest and recommended way to installdjango-redis-aiogramis fromPyPIpipinstalldjango-redis-aiogramYou need to addtelegram_bottoINSTALLED_APPSin your projectssettings.py.# settings.pyINSTALLED_APPS=(...'telegram_bot',...)Also, you need to specify the minimum settings:# settings.pyTELEGRAM_BOT={'REDIS_URL':REDIS_URL,'TOKEN':TELEGRAM_BOT_TOKEN,}Next, add a separate container to your docker-compose.yml.
(optional, if you want to use routers and handlers)# docker-compose.ymlservices:...telegram_bot:container_name:telegram_botrestart:alwayscommand:python manage.py start_tgbotbuild:context:./Example UsageTo send a message, use the following code:# test.pyfromaiogramimporttypes,Ffromtelegram_botimportbot# sending a message directlybot.send_raw(chat_id=CHAT_ID,text=TEXT)bot.send_raw('send_photo',chat_id=CHAT_ID,caption=TEXT,photo=URL)# sending a message via redisbot.send_redis(chat_id=CHAT_ID,text=TEXT)bot.send_redis('send_photo',chat_id=CHAT_ID,caption=TEXT,photo=URL)# markup examplemarkup=types.InlineKeyboardMarkup(inline_keyboard=[[types.InlineKeyboardButton(text='best project ever',web_app=types.WebAppInfo(url='https://pypi.org/project/django-redis-aiogram'))]])bot.send_raw(chat_id=CHAT_ID,text=TEXT,reply_markup=markup)bot.send_redis(chat_id=CHAT_ID,text=TEXT,reply_markup=markup)# if RAISE_EXCEPTION is True, you can use try-except to handle errors from send_rawfromaiogram.exceptionsimportTelegramBadRequesttry:bot.send_raw(chat_id=CHAT_ID,text='**test*',parse_mode='Markdown')exceptTelegramBadRequest:print('Telegram bad request :)')If you need to use handlers, create filetg_router.py(by default) in your app, use the following code:fromaiogramimporttypes,Ffromtelegram_botimportbot@bot.message(F.text.startswith('/start'))asyncdefstart_handler(message:types.Message)->None:awaitmessage.answer('hi')@bot.message()asyncdefsimple_handler(message:types.Message)->None:awaitmessage.reply(message.text)You can use all handler types like in aiogram.SettingsYou can override settings:# settings.pydefdefault_kwargs(function:str)->dict[str,Any]:"""Default kwargs for telegram bot functions."""prepared_dict={'send_message':{'parse_mode':'HTML'},'send_photo':{'parse_mode':'Markdown','caption':'`Photo`'}}returnprepared_dict.get(function,{})TELEGRAM_BOT={{# event expiration time in redis'REDIS_EXP_TIME':5,# redis key for handling expired event'REDIS_EXP_KEY':'TELEGRAM_BOT_EXP',# redis key for collecting messages'REDIS_MESSAGES_KEY':'TELEGRAM_BOT_MESSAGE',# name of the module to find'MODULE_NAME':'tg_router',# default kwargs for telegram bot'DEFAULT_KWARGS':default_kwargs,# telegram bot token'TOKEN':<TELEGRAM_BOT_TOKEN>,# url for redis connection'REDIS_URL':<REDIS_URL>,# max retries for sending message'MAX_RETRIES':10,# raise exception if error occurred'RAISE_EXCEPTION':False}
Package: django-redis-connector
Django Redis ConnectorInstallationpip install django-redis-connectorUsagefrom django_redis_connector import connector

# Redis 设置
REDIS = {
    'default': {
        'HOST': '127.0.0.1',
        'PORT': 6379,
        'USER': '',
        'PASSWORD': '',
        'db': 0,
    }
}

# Redis 连接
REDIS_CACHE = connector(REDIS.get('default', {}))
Package: django-redis-counter
Django application that keeps content visit count in redis first, then dump to database via extra job.Installpip install django-redis-counterDependenciesdjangoredisUsageAdd drc in INSTALLED_APPS in django settings.py. drc is short for django-redis-counter.INSTALLED_APPS = [
    ...
    'drc',
    ...
]Define counter models in app’s models.py.from drc.models import Counter

class Page(models.Model):
    title = models.CharField(max_length=32)
    ...

class PageCounter(Counter):
    passCall incr in views.def display_page(request, page_id):
    page = Page.objects.get(pk=page_id)
    page_visit_number = PageCounter.incr(page)
    return render(request, "page.html", {
        "page": page,
        "page_visit_number": page_visit_number,
    })Create a script to dump cached data to database. Name the script to page_counter_dump.sh or what ever you like.#!/bin/bash
cd /your/project/path
python manage.py drc-dumpAdd dump task as schedule job, e.g. crontab job.* * * * * page_counter_dump.sh # dump the cached data every minutes
1 * * * * page_counter_dump.sh # dump the cached data every hour.
Package: django-redis-data-manager
django-redis-data-managerA simple django application provide simple redis cache data manager functional.Installpip install django-redis-data-managerIf you want to use guniocrn web server, installgunicornit by yourself.If you want to use mysql database, installmysqlclientby yourself.Install Server Commandmanage-django-redis-data-managerCommand HelpC:\Workspace\redis-dataman>manage-django-redis-data-manager

Type 'manage-django-redis-data-manager help <subcommand>' for help on a specific subcommand.

Available subcommands:

[auth]
    changepassword
    createsuperuser

[contenttypes]
    remove_stale_contenttypes

[django]
    check
    compilemessages
    createcachetable
    dbshell
    diffsettings
    dumpdata
    flush
    inspectdb
    loaddata
    makemessages
    makemigrations
    migrate
    sendtestemail
    shell
    showmigrations
    sqlflush
    sqlmigrate
    sqlsequencereset
    squashmigrations
    startapp
    startproject
    test
    testserver

[django_server_controller]
    wsgi-server

[sessions]
    clearsessions

[staticfiles]
    collectstatic
    findstatic
    runserverUsageWe will try to load your private settings fromdjango_redis_data_manager_project_local_settings.pymodule.By default the admin site registered under path:/admin/. You can change it by setADMIN_SITE_URL=<your site path>indjango_redis_data_manager_project_local_settings.py.By default we try to use sqlite3 database. You can change it by set newDATABASESindjango_redis_data_manager_project_local_settings.py.Releasesv0.1.0First release.v0.1.1Add depends package in requirements.txt.v0.1.2AddADMIN_SITE_URLto custom admin site register url.Add default WSGI_SERVER_ENGINE togunicorn, and add the defaultuwsg.conf.pywhich will let the server listen on16379port to do service.v0.1.3Fix static link problem.v0.1.4Add django_safe_fields in app_requires.Setup fix.v0.1.5Show json in pretty way.v0.1.6Fix dependence package version problem.v0.1.7Doc update.v0.1.8Fix ugettext problem.
Package: django-redisdb
Django-redisdb is Redis backend for Django that allows
using Redis as a cache and as a database at the same time.
Django-redisdb provides backends for master/master and sharded configuration.Installationpip install django-redisdbQuick usage guideIn settings.py:CACHES={'redis_ring':{'BACKEND':'redisdb.backends.RedisRing',# sharding backend'DB':0,'LOCATION':['localhost:6379','localhost:6380',],},'redis_copy':{'BACKEND':'redisdb.backends.RedisCopy',# copying backend'DB':0,'LOCATION':['localhost:6379','localhost:6380',],}}Usage:>>>fromdjango.core.cacheimportcaches>>>caches['redis_ring'].set('one_key',123)# set key1 only on on server[True]>>>caches['redis_copy'].set('other_key',234)# set key2 on all servers[True,True]With RedisRing value is set only on one node. With RedisCopy it’s set on all
nodes (two nodes in examle above).Redis is much more powerfull then simple cache. It should be seen
as a specialized database. With django-redisdb you can use all its power.
For example you can use redis’ sorted sets:>>>caches['redis_copy'].zadd('myzset',1,'one')[0,1]>>>caches['redis_copy'].zadd('myzset',2,'two')[0,1]>>>caches['redis_copy'].zadd('myzset',3,'three')[0,1]>>>caches['redis_copy'].zrange('myzset',0,-1)['one','two','three']>>>caches['redis_copy'].zrange('myzset',0,-1,withscores=True)[('one',1.0),('two',2.0),('three',3.0)]Supported Django versionsdjango-redisdb runs on Django 1.2 to Django 1.8DocumentationFull documentation is available athttp://django-redisdb.readthedocs.org
Package: django-rediser
Index:IntroductionInstallationUsageExamplesIntroductionDjango-Rediser (Django Redis Helper) is a simple yet convenient wrapper
for redis package. It lets you use Redis DB without worrying about
connections and json encoding/decoding.There’s 2 classes right now:RedisStorage: main wrapper class, that ensures you have a connection
to Redis server when you send commands to it.RedisJSON: RedisStorage descendant, implementing json
encoding/decoding.InstallationTo install Django-Rediser, simply:pip installdjango-rediserUsageWe’ll add usage information soon.ExamplesWe’ll add some examples soon.
Package: django-redis-metrics
This app allows you do define various named metrics (such as ‘New Users’,
‘Downloads’, or ‘Purchases’) and record when they happen.Each metric can be assigned a Category or an optional Expiration time, and is
stored at the second, minute, hourly, daily, weekly, monthly, and yearly level,
so you can see the frequency of your data at different granularities.Here’s a sneak peak at how it works:>>> from redis_metrics.utils import metric
>>> metric("Downloads", category="User Metrics")CompatibilityThis app works with Python 3 and is tested with Django 2.2. For support for
older versions of Django, see the1.7.0 release.DocumentationView the full documenation athttp://django-redis-metrics.readthedocs.io/en/latest/.LicenseThis code is distributed under the terms of the MIT license. See theLICENSE.txtfile.
Package: django-redis-ratelimit
A fixed window rate limiting based on RedisRequirementsPython >= 3.6Django >= 1.11RedisInstallationTo install django-redis-ratelimit, simply:$pipinstalldjango-redis-ratelimitNB!django-redis-ratelimit requires a running Redis server. SeeRedis’s quickstartfor
installation instructions.Getting startedFirst, add the middleware to yoursettings.py:MIDDLEWARE = [
    # ...

    'redis_ratelimit.middleware.RateLimitMiddleware',
]this will make sure that end user sees the HTTP 429 response.Next, apply theratelimitdecorator to the view:from django.http import HttpResponse
from redis_ratelimit import ratelimit

@ratelimit(rate='5/m')
def index(request):
    return HttpResponse("Hello World!")Memory requirementsFor this example we will assume that each key takes up roughly 250 bytes
and each value is 4 bytes:250 + 4 * 1 million unique hits = ~254 MegabytesNotesRedis Rate Limiting Pattern
#2LicenseMIT
Package: django-redissentry
This is django specific app for RedisSentry. For generic package,
(which this app is dependent on) see redissentry-core.Installationsettings.py:MIDDLEWARE_CLASSES += (
    'redissentry.middleware.RequestMiddleware',
)

INSTALLED_APPS += (
    'redissentry',
)Finetuningsettings.py:RS_REDIS_HOST = 'localhost'
RS_REDIS_PORT = 6379
RS_REDIS_PASSWORD = ''
RS_REDIS_DB = 0

RS_FA_PER_IP = 5         # block ip after every N failed attempts
RS_FA_PER_USERNAME = 5   # block username after every N failed attemptsAlso the class structure is designed in such a way as to facilitate further finetuning
through inheritance.