Saravanan666/pypi-org huggingface dataset:
Package: django-session-timeout-joinup
django-session-timeoutAdd timestamp to sessions to expire them independentlyInstallationpipinstalldjango-session-timeout-joinupUsageUpdate your settings to add the SessionTimeoutMiddleware:MIDDLEWARE_CLASSES=[# ...'django.contrib.sessions.middleware.SessionMiddleware','django_session_timeout.middleware.SessionTimeoutMiddleware',# ...]And also add theSESSION_EXPIRE_MAXIMUM_SECONDS:SESSION_EXPIRE_MAXIMUM_SECONDS=28800# 8 hoursBy default, the session will expire X seconds since the user do login.SESSION_EXPIRE_SECONDS=3600# 1 hourThe session will expire X seconds after the start of the session or renew it.
To renew the session X seconds after expire, use the following setting:SESSION_EXPIRE_AFTER_LAST_ACTIVITY_GRACE_PERIOD=1800# 30 minutesTo redirect to a custom URL define the following setting:SESSION_TIMEOUT_REDIRECT='your_redirect_url_here/'
Package: django-session-user
===================django-session-user===================This app is a simple piece of middleware that can be added to your Djangoproject which will store and retrieve the logged-in user's information fromthe session.Installation------------Add the sesionuser middleware line to your MIDDLEWARE_CLASSES after theAuthenticationMiddleware:MIDDLEWARE_CLASSES = (# ...'django.contrib.auth.middleware.AuthenticationMiddleware','sessionuser.middleware.SessionUserMiddleware',# ...)Why do this?------------Your server is already fetching the contents of the user's session, whichalready contains the user's identity.  Why not store the rest of the userclass's data along with it?  That way you don't have to make a request to thedatabase for every authenticated web request.Additionally if you are using a cookie-based session backend (likedjango-cookie-sessions, written by yours truly) you can have other systems,maybe even non-Django systems, which read the cookie and know more informationabout the user.Customizable Settings---------------------COOKIE_USER_REFRESH_TIME [= 14400]:The number of seconds that need to elapse before the user is fetched fromthe database instead of trusting the cookie.  This is useful for makingsure that even if the user's properties are changed in the database,the user's cookie will still be updated.
Package: django-session-view-mixin
Your project description goes hereDocumentationThe full documentation is athttps://django-session-view-mixin.readthedocs.io.QuickstartInstall Django Session View Mixin:pip install django-session-view-mixinAdd it to yourINSTALLED_APPS:INSTALLED_APPS=(...'session_view_mixin',...)FeaturesTODORunning TestsDoes the code actually work?source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ toxDevelopment commandspip install -r requirements_dev.txt
invoke -lCreditsTools used in rendering this package:Cookiecuttercookiecutter-djangopackageHistory0.1.0 (2021-10-19)First release on PyPI.0.1.1 (2021-10-20)Update github actions.0.1.2 (2021-10-21)Fix coveralls.0.1.3 (2021-10-21)Fix readme.
Package: django-ses-sns-tracker
django-ses-sns-trackerA simple wrapper around django-ses to receive and persist sns event data.Records mail delivery in theSESMailDeliverymodel and updates the state if a matching SNS notification is received.RequirementsDjangoversion 3.2+APostgreSQLDatabaseQuick startAddses_sns_trackerto your INSTALLED_APPS setting like this:INSTALLED_APPS=[# ...'ses_sns_tracker',]Runpython manage.py migrateto create the models.Setupdjango-sesAdd the webhook view tourls.py:fromdjango_ses.viewsimportSESEventWebhookViewurlpatterns=[# ...path('ses-events/',SESEventWebhookView.as_view(),name='handle-event-webhook'),# ...](Optional) Useses_sns_tracker.backends.SESSNSTrackerBackendas your default email backend:EMAIL_BACKEND = 'ses_sns_tracker.backends.SESSNSTrackerBackend'This way all emails will be sent via the Amazon SES API.(Optional) Send an email via theSESMailDeliverymanager (doesn't requireSESSNSTrackerBackendas the default mail backend):fromdjango.core.mailimportEmailMessagefromses_sns_tracker.modelsimportSESMailDeliverymessage=EmailMessage(subject='email subject',body='email body',from_email='sender@example.com',to=['recipient@example.com'],)SESMailDelivery.objects.create_message(message,fail_silently=False,fake_delivery=False)SettingsSES_SNS_TRACKER_DEBUG_BACKEND = 'django.core.mail.backends.console.EmailBackend'Set mail backend to use for the actual mail delivery inDEBUGmode (SESMailDeliveryobjects
will still be created).Default:NoneDevelopment setupInstall development dependencies:poetryinstallInstall theruff extensionfor code linting & formatting in your IDE.(Optional) Override settings inexample_proj/settings_local.py&tests/settings_local.pyas required.
Package: django-setmagic
# django-setmagicMagically editable settings for winged pony lovers.## Why?Because sometimes it's cool to set global configuration values through a niceinterface on the Django admin. And that's what SetMagic make possible. Enjoy!## Install and set upInstall it into your project's virtual environment:$ pip install django-setmagicMake sure you already have the [Django admin][1] set up! Then append to yourDjango project's `INSTALLED_APPS` setting.INSTALLED_APPS = [...'django.contrib.admin','setmagic',...]Also enable the SetMagic template context processor, if you want to use it onyour templates, by adding it to the `TEMPLATE_CONTEXT_PROCESSORS` list:TEMPLATE_CONTEXT_PROCESSORS = [...'setmagic.context_processors.load_setmagic',]Create the necessary tables, like usual:$ python manage.py syncdb...and that's pretty much it. :)## UsageSetMagic will look into your project's settings for the name `SETMAGIC_SCHEMA`.It should be defined as a pure Python list of groups like the example below:SETMAGIC_SCHEMA = [('Facebook App Credentials', [dict(name='FACEBOOK_APP_ID',label=u'Facebook app ID',help_text=u'Unique app identification code provided by Facebook.'),dict(name='FACEBOOK_APP_SECRET',label=u'Facebook API secret',help_text=u'Unique and secret API code provided by Facebook.'),]),('Tracking', [dict(name='GOOGLE_ANALYTICS_CODE',label=u'Google Analytics code',help_text=u'Domain to identify this site through the GA API.'),]),]From now on, you should be able to set values for your configurations throughthe Django admin. And you will, of course, be able to set and retrieve thesevalues on your code.from setmagic import settings# Instantly save onto the database!settings.FACEBOOK_APP_ID = '000000000000000'# Retrieve the setting value from the databaseprint(settings.FACEBOOK_APP_ID)# Deletes it from the databasedel settings.FACEBOOK_APP_IDIf you added the template context processor like described above, you can alsouse SetMagic values on your templates.<p>My Facebook app ID is <code>{{ setmagic.FACEBOOK_APP_ID }}</code></p>See? No mistery. :)## Platform support* Python 2.6+* Python 3.x* Django 1.5+## ContributeYou can play with the code at SetMagic's reposity on [GitHub][2] or [donate][3]me a few bucks from heart so I can write open source code without worrying toomuch about bills.[1]: https://docs.djangoproject.com/en/dev/ref/contrib/admin/[2]: http://github.com/7ws/django-setmagic[3]: https://gratipay.com/emyller/
Package: django-setman
Django settings manager. Another.RequirementsPython2.6 or higherDjango1.3 or higherInstallationOn most UNIX-like systems, you’ll probably need to run these commands as root
or using sudo.To install use:$ pip install django-setmanOr:$ python setup.py installAlso, you can retrieve fresh version ofsetmanfromGitHub:$ git clone git://github.com/odeskps/django-setman.gitand placesetmandirectory somewhere toPYTHONPATH(orsys.path).Licensedjango-setmanis licensed under theBSD License.Usage. More informationSee full documentation atdocs/directory or browse onlinehere.Bugs, feature requests?If you found some bug insetmanreusable app, please, add new issue to the
project’sGitHub issues.
Package: django-settings-context-processor
---------- django-settings-context-processor -----------------------------------------------------------------What does it do?---------------Makes specified django settings visible in the template rendering context.How does it do it?------------------django-settings-context-processor takes the settings variableTEMPLATE_VISIBLE_SETTINGS, which should be an iterable of strings,and looks for a settings of the name of each iterable.  The name-valuepair of this setting is then added to the template rendering context.Can I see an example?---------------------Yes!  Assuming the root django-settings-context-processor is in yourPYTHON_PATH, this should work:settings.py:INSTALLED_APPS = (......'settings_context_processor',)TEMPLATE_CONTEXT_PROCESSORS = (# the first 5 here are the django 1.2.1 default context processors'django.contrib.auth.context_processors.auth','django.core.context_processors.debug','django.core.context_processors.i18n','django.core.context_processors.media','django.contrib.messages.context_processors.messages',......'settings_context_processor.context_processors.settings',)# define some settings we'd like to exportCONTACT_PHONE='(555) 555-5555'CONTACT_EMAIL='contact@someplace.comCONTACT_ADDR_STREET='123 Anywhere Rd.'CONTACT_ADDR_CITYSTATE='Anyplace, AS 12345'# for settings_context_processorTEMPLATE_VISIBLE_SETTINGS = ('CONTACT_PHONE','CONTACT_EMAIL','CONTACT_ADDR_STREET','CONTACT_ADDR_CITYSTATE',)some_template.html:<ul class="contact"><li>{{ CONTACT_PHONE }}</li><li><a href="mailto:{{ CONTACT_EMAIL }}">{{ CONTACT_EMAIL }}</a></li><li>{{ CONTACT_ADDR_STREET }}</li><li>{{ CONTACT_ADDR_CITYSTATE }}</li></ul>
Package: django-settingsdict
This is small helper that makes it easier to store distributable django app settings in projectsettings.pyas a dict.
Purpose is to keep settings file simple and clean.
With this it’s also easier to set defaults for the settings and warn about settings that have been removed.Helper also supports marking settings that should be imported before returning.
Import is done usingdjango.utils.module_loading.import_string.Helper resolves variables when requested for the first time and caches the value for faster lookup next time.
Variables that are not inrequiredordefaultsraiseAttributeError.
If you like to clear the cache, you can use_clear_cached().Usingmigrate, you can configure list of migration actions.
Parameter takes a list of tuples, where first field is the new setting name, second is the old name outside of the dictionary and optional third is callable.
The callable has formatmigrate_script(old_value: Any, current_dictionary: dict)->Any, wherecurrent_dictionarycontains all values read so far.Design is based on class done inDjango REST framework.ExampleSetting defitions in your applicationsapp_settings.py(for example):fromdjango_settingsdictimportSettingsDictREQUIRED=('IMPORTANT_SETTING',)DEFAULTS={'URL_NAME':'test_app','MIGRATED_VALUE':'something old, but supported','REVERSE_FUNC':'django.core.urlresolvers.reverse',}IMPORT_STRINGS=('REVERSE_FUNC',)REMOVED=('OLD_SETTING',)MIGRATE=(('MIGRATED_VALUE','MY_APP_OLD_OPTION'),)app_settings=SettingsDict('MY_APP',required=REQUIRED,defaults=DEFAULTS,removed=REMOVED,migrate=MIGRATE,import_strings=IMPORT_STRINGS)Configuration in your projectssettings.py:MY_APP={'IMPORTANT_SETTING':'some value','URL_NAME':'test_app_2',}MY_APP_OLD_OPTION='this is not fixed yet'And in your application code:from.app_settingsimportapp_settingsprint(app_settings.IMPORTANT_SETTING)print(app_settings.URL_NAME)print(app_settings.REVERSE_FUNC)print(app_settings.MIGRATED_VALUE)would make following result:some value
test_app_2
<function reverse at 0x7fd5119e0578>
this is not fixed yet
Package: django-settings-diff
A very simple tool to help diff two Django settings modules.MotivationLet’s say that you have done some significant refactoring to your settings module. For example, you have gone from a single settings file to a modular approach, where there is no longer a singlesettings.py. You want to make sure that your settings are effectivelyexactlythe same as before, though! Of course you can’t rely on simple file diffing, since there is no longer a singlesettings.py.There are some non-intuitive things to account for, whichdjango-settings-diffhandles for you:Even with a singlesettings.py, there is a (potentially) significant difference between simply importing the file and the “final” settings that are used by Django (seehttps://docs.djangoproject.com/en/2.1/topics/settings/#using-settings-in-python-code). That is, we want to compare theactual settings at runtime!Thesettingsobject cannot be naively treated as adict– it is similar, but different enough to prevent easy diffing (the native settings object thwarts bothpprintanddeepdiff).So, it isn’t doing anything crazy, but it removes some overhead.InstallationInstall from pip (recommended):$ pip install django-settings-diffOr, install straight from the repo:$ git clone https://github.com/GreenBankObservatory/django-settings-diff
$ pip install django-settings-diffNote that this will install a wrapper script for you:diffsettingsEntry PointsUse the wrapper script (recommended):$ diffsettings -hCall the module:$ python -m django_settings_diff -hImport as library:$ python
>>> from django_settings_diff import diffsettings
>>> help(diffsettings)UsageThere are two standard usage patterns.You should first ensure that you have saved two versions of your settings. For this example we will usemyapp/settings_old.pyandmyapp/settings_new.py.Alternatively, you could use the sameDJANGO_SETTINGS_MODULEfor both dumps, but swap the settings file itself in between. This is useful in repositories that rely on the settings file being a specific name, for example.#1: Compare Python objects directlyThis usesdeepdiffinternally to perform the diff.Dump SettingsPickle the settings modules to disk:$ DJANGO_SETTINGS_MODULE=myapp.settings_old diffsettings --dump old_settings.pkl
$ DJANGO_SETTINGS_MODULE=myapp.settings_new diffsettings --dump new_settings.pklDiff SettingsNow we can diff the two settings objects:$ diffsettings old_settings.pkl new_settings.pklSee the documentation fordeepdifffor help deciphering the output.#2: Compare via external diff toolIn this method the settings are dumped as text files and then compared using a standard diff tool.Dump SettingsDump the settings modules to disk (internally this usespprintto print the settings object):$ DJANGO_SETTINGS_MODULE=myapp.settings_old diffsettings --dump old_settings.txt
$ DJANGO_SETTINGS_MODULE=myapp.settings_new diffsettings --dump new_settings.txtDiff SettingsThen, use your favorite diff tool to compare these. This should work quite well, since the object hierarchy has been broken up line by line.For example:$ tkdiff {old,new}_settings.txt
Package: django-settings-export
Often it is needed to make some of your Django project’s settings
accessible from within templates. This app provides a simple mechanism
for doing just that.Principles:Explicit is better than implicit:Only explicitly listed
settings keys are exported to templates.Errors should never pass silently:Accessing an undefined
or unexported setting key from a template results in an exception.Tested on Python 2.7+, Django 1.5+.Installation$pipinstalldjango-settings-exportAdd'django_settings_export.settings_export'to
template context processor list in yoursettings.py:Django 1.8 and newer:TEMPLATES=[{# …'OPTIONS':{'context_processors':[# …'django_settings_export.settings_export',],},},]Django older than 1.8:TEMPLATE_CONTEXT_PROCESSORS=[# [...]'django_settings_export.settings_export',]UsageAll settings that should be made accessible from templates need to be
explicitly listed insettings.SETTINGS_EXPORT:# settings.pyDEBUG=TrueGA_ID='UA-00000-0'SETTINGS_EXPORT=['DEBUG','GA_ID',]Now you can access those exported settings from your templates
viasettings.<KEY>:<!-- template.html -->{% if not settings.DEBUG %}<script>ga('create','{{ settings.GA_ID }}','auto');</script>{% endif %}Thesettingsvariable is an instance ofdictsubclass, so
you use all the methodsdictprovides. For example, you can iterate over
the keys and values using ,settings.keys,settings.values,settings.items, etc:{% for key, value in settings.items %}
    {{ key }}: {{ value }}
{% endfor %}Changing thesettingsvariable nameIf you wish to change the name of the context variable to something besidessettings, addSETTINGS_EXPORT_VARIABLE_NAME = 'custom_name'to yoursettings.py. This is useful when some other plugin is already addingsettingsto your template contexts.# settings.pyFOO='bar'SETTINGS_EXPORT=['FOO']SETTINGS_EXPORT_VARIABLE_NAME='my_config'<!-- template.html -->{{ my_config.FOO }}ExceptionsThese custom exceptions can be thrown:Listing an undefined setting key inSETTINGS_EXPORTresults in anUndefinedSettingError.Accessing a unexported setting key on thesettingsobject in a template
results in anUnexportedSettingError.All subclass fromdjango_settings_export.SettingsExportError.Demo & TestsSee the source code of the bundleddemo app.Development$cdtests# Run demo$pythonmanage.pyrunserver# Run tests on current Python$pythonmanage.pytest# Run tests on all Pythons$toxChange LogSeeCHANGELOG.LicenceBSD. SeeLICENCEfor more details.ContactJakub Roztocilhttp://roztocil.cohttps://github.com/jkbrzthttps://twitter.com/jkbrzt
Package: django-settings-file
Unmaintained (2022-12-07)I stopped maintaining this package as it has never been popular.
If you want to use the functionality I recommend copying the small amount of code into your project.Let Django use settings from an arbitrary Python file instead of an importable module.As perJames Pic’s idea posted on the django-developers mailing list.RequirementsPython 3.7 to 3.11 supported.Django 3.2 to 4.1 supported.Want to work smarter and faster?Check out my bookBoost Your Django DXwhich covers many ways to improve your development experience.UsageInstall withpython-mpip installdjango-settings-file.Edit yourmanage.pyandwsgi.pyto swap out Django’s default logic for settingDJANGO_SETTINGS_MODULEto
instead do:importdjango_settings_filedjango_settings_file.setup()Addos.environ.setdefault('DJANGO_SETTINGS_FILE','/path/to/default.py')before thesetup()call, unless you
can be sureDJANGO_SETTINGS_FILEwill always be defined in your environment. You might need to figure out the
path relative to yourmanage.pywith someos.pathmanipulation.Run it! IfDJANGO_SETTINGS_MODULEis defined, it will raise aDjangoSettingsFileErrorwith a message about
how onlyDJANGO_SETTINGS_FILEis allowed now. IfDJANGO_SETTINGS_FILEis not defined, it will also fail with
aDjangoSettingsFileErrorwith a message about defining it. Otherwise Django should start with the settings!How it worksdjango-settings-fileimports the contents of the specified file using the import machinery available on your Python
version (different logic for 2 and 3) and copies it contents into its own module, which Django sees as the settings
file defined via the traditionalDJANGO_SETTINGS_MODULE. Nothing about Django is really touched, it’s just a
hacky module.CaveatsIf the Python file defined byDJANGO_SETTINGS_FILEtries to do any imports, the directory the file is in will not
be onPYTHONPATH, so the author of the settings file might get some surprises.Additionally, you might experience other problems from loading a file whilst it’s not onPYTHONPATH.If you want your settings file to extend another one, it will probably find it easiest toimportthe base one
from a location onPYTHONPATH, otherwise it too will have to do use the same import ‘hacks’ to load the default
settings.File paths are not portable between operating systems, so you may need logic to support both Unix and Windows at
once.File paths are not portable between.pyand.pycfiles. In most cases this means a.pycfile will not be
used for settings since it can’t be guaranteed to be there, slightly slowing down import time.DJANGO_SETTINGS_MODULEandDJANGO_SETTINGS_FILEcan’t both be used by the same project, since the module is
required for the file-based logic. You might be able to allow them both with extra logic, pull requests accepted.¯\_(ツ)_/¯- this is kind of unknown territory, this library has not been tested in any real project, just with
the example project in the test folder.
Package: django-settings-holder
Django Settings Holderpipinstalldjango-settings-holderDocumentation:https://mrthearman.github.io/django-settings-holder/Source Code:https://github.com/MrThearMan/django-settings-holder/Contributing:https://github.com/MrThearMan/django-settings-holder/blob/main/CONTRIBUTING.mdThis library provides utilities for Django extensions that want to define their own settings dictionaries.
Settings can be included in a SettingsHolder that allows them to be accessed via attributes.
User defined settings can be reloaded automatically to the SettingsHolder from thesetting_changedsignal.
Functions in dot import notation are automatically imported so that the imported function is available in
the SettingsHolder. You can also define validators for settings that will be run when the setting is first accessed.
Package: django-settingsjs
Configurable JavaScript settings in Django==========================================INSTALATION===========Add 'settingsjs' to your INSTALLED_APPS (for the templates)Include 'settingsjs.urls' in your urls.Add a script tag with src="{% url settings_js %}"e.g.<script type="text/javascript" src="{% url settings_js %}"></script>Access the settings in JavaScript using Setting.get and Setting.get:<script type="text/javascript">var myapp_settings = Setting.get('myapp-settings');Setting.set('some_key', 'some value');</script>Setting JavaScript settings===========================Use the SETTINGS_JS setting to specify settings:e.g.SETTINGS_JS = {'myapp-settings': {"fu": "bar",}}Use settingsjs.signals.collect_settings:e.g. In a file that will always be loaded (such as a models or urls file).from settingsjs.signals import collect_settingsfrom django.dispatch import receiver@receiver(collect_settings)def videos_settingsjs(sender, jssettings=None, **kwargs):if jssettings is not None:jssettings['myapp-settings'] = {"fu": "bar",}
Package: django-settings-json
django-settings-jsonSamplesettings.jsonfile:{"DEBUG":true,"TIME_ZONE":"America/New_York"}UsageUseget_setting()when retrieving environment variables on yoursettings.pyfile:fromsettings_jsonimportget_settingDEBUG=get_setting('DEBUG')TIME_ZONE=get_setting('TIME_ZONE')GitIgnoreRemember to addsettings.jsoninto your.gitignore, so it don't get tracked.settings.jsonMissing VariablesIf you forget to add a variable on yoursettings.json, it'll raise an error like the one below:Set the TIME_ZONE environment variable on settings.json
Package: django-settings-list
django-settings-listA simple, reusable Django app that lists the settings values for a deployed or
running project using a custom admin view accessible only by superusers.Technically, admin is not required, but by default the Settings List view is
styled similarly to Django Admin.InstallationMake thesettings_listmodule available in your Python environment.Make thesettings_list/templates/directory available in your project,
either by addingsettings_listtoINSTALLED_APPSand enabling theapp_directoriestemplate loader, or by specifying the path manually inTEMPLATE_DIRS.Add a URL pattern for thesettings_list.views.settings_listview. For
example:(r'^admin/settings/$', 'settings_list.views.settings_list'),Keeping private settings privateDjango Settings List usesdjango.views.debug.get_safe_settings, which
obfuscates “secret” settings (currently, any setting with a name containing
SECRET, PASSWORD, PROFANITIES_LIST, or SIGNATURE). This is the same filter
used by the debug traceback reporter.You can also manually specify additional settings to keep private by adding a
PRIVATE_SETTINGS setting to your project. For example:PRIVATE_SETTINGS = [
    'AUTHNET_MERCHANT_ID',
    'AUTHNET_TRANSACTION_KEY',
    'AWS_ACCESS_KEY_ID',
    'AWS_SECRET_ACCESS_KEY',
]