Saravanan666/pypi-org huggingface dataset:
Package: dj-secret-settings
Yet Another Django Settings HelperThis library allows secret settings to be easily changed for dev/Staging/Production etc purposes. e.g. One might obtain development settings from the process environment but later deploy toGoogle Compute Enginewhere use ofGoogle Secret Manageris recommended. If the app later finds its way ontoAWS, a suitable fetcher can be installed or written.I tend to put all the secret settings for an environment in a single secret as a JSON document, for cost and convenience. You can also put non-secret settings in the same document or install them as environment variables as you prefer.** I have no affiliation with Google, Amazon or any other cloud computing provider! **Installationpip install dj_secret_settingsConfigurationInstall settings fetchers to get the raw data from the store, and settings stores to make sense of the raw data and return pieces of it on demand.The package can be configured with a string or by using the environment variableDJ_SECRET_SETTINGS_URLwith the form:store_type+fetcher_type://information.used.by/the/fetcher/and/or/the/store_type?like_a=urle.g.json+gsm://anything-here-perhaps-service-account/projects/123456789/secrets/my-secret/versions/42indicates that data will be fetched fromGoogle Secret Manager* and interpreted as a JSON string.* configuration of this is obviously required too, contact me if you need help with that.The package includes aGoogle Secret Managerfetcher, with JSON and environment variable store types. These can be overridden by installing a root package of the form dj_secret_settings_{store_type} (e.g. dj_secret_settings_json) or dj_secret_settings_{fetcher_type} (e.g dj_secret_settings_gsm). Alternatively you can install differently named root packages and modifiy the URL (e.g dj_secret_settings_yaml for a yaml store using the URL of the form yaml+gsm://...).Usagefrom dj_secret_settings import settings_store
store = settings.store.load("json+gsm://anything-here-perhaps-service-account/projects/123456789/secrets/my-secret/versions/42")

MAX_SIZE = store.get_value('MAX_SIZE', default=314, coerce_type=int)
IS_PRODUCTION = store.get_boolean('is_production', default=FALSE)
MY_LIST = store.get_array('MY_LIST')
A_MAP = store.get_mapping('A_MAP', default={})defaults are always optional, as iscoerce_typeonget_value
Package: dj-sentry
Dj_sentryThis Django application intializeSentry SDKto your Django application.How to installYou can install this packaging by using:pipinstalldj_sentryAlternatively, if you use a package manager, for example Poetry, you can use:poetryadddj_sentryHow to configureIn yoursettingsfiles, add the following settings to configure the Sentry SDK according with your needs:SettingTypeDescriptionSENTRY_DSNstrmandatorySentry project DSN.SENTRY_ENVIRONMENTstrmandatoryEnvironment where the application is running (for example:production,pre-production,staging)SENTRY_APP_PACKAGE_NAMEstroptionalPackage name of your application¹.SENTRY_EXTRA_INTEGRATIONSlistoptionalList ofSentry integrationsyou want to use (in addition of the Django integration already set-up)SENTRY_EXTRA_OPTSdictoptionalDict with additionnal settings for configuring the Sentry client. SeeSentry client configuration¹: We usepkg_resourcesfrom Setuptools to get the package version of your application and send it on every events. This setting is optional buthighlyrecommended.By default, the settingtraces_sample_ratesend_default_piihave the following default valuesSettingValuetraces_sample_rate0(no tracing samples sent to Sentry)send_default_piiTrue(send user information in events)You can change de values of those settings by using theSENTRY_EXTRA_OPTSsetting. For example, to disable the setting that send user informations:SENTRY_EXTRA_OPTS={"send_default_pii":False,# Do not send user information in Sentry events}Here's an example of valid configuration:fromsentry_sdk.integrations.redisimportRedisIntegrationfromcompany_cms.utils.sentryimportbefore_send_filter# Your Django configuration ...SENTRY_DSN="https://<token>@sentry.company.com/<project_id>"SENTRY_ENVIRONMENT="production"SENTRY_APP_PACKAGE_NAME="company_cms"SENTRY_EXTRA_INTEGRATIONS=[RedisIntegration()]# Add Redis integration to Sentry SDKSENTRY_EXTRA_OPTS={"before_send":before_send_filter,# Do some events filtering before sending them (see: https://docs.sentry.io/platforms/python/configuration/filtering/)}# Your Django configuration ...LicenseThis project is released underBSD-3 Clause.
Package: dj-services
dj-servicesThanks to this library, you can build your business logic in beautiful
services, not in huge views and fat models.Getting StartedInstall this library usingpip$ pip install dj-servicesCreateservices.pymodule in your Django app and create your first service# services.pyfromdjservicesimportCRUDServicefrom.modelsimportMyModelfrom.formsimportMyFormclassMyService(CRUDService):model=MyModelform=MyFormAfter that you can use this service inviews.py# views.pyfromdjango.shortcutsimportrenderfrom.servicesimportMyServicedeflist_entries(request):service=MyService()entries=service.get_all()returnrender(request,'some_template.html',{'entries':entries})That's all. Now you can add business logic in your service. Let's go!DocumentationYou can read documentation in this repositorywikiRunning the testsIf you want to run the tests you need to run the following command:$ ./manage.py testContributingPlease readCONTRIBUTING.mdfor details on our code
of conduct, and the process for submitting pull requests to us.VersioningWe useSemVerfor versioning. For the versions
available, see thetags on this
repository.AuthorsArtyom Loskan-artemowkinSee also the list ofcontributorswho participated in this project.LicenseThis project is licensed under theGNU General Public License v3.0
Package: dj-sessions
Enhanced session traciking for DjangoDocumentationThe full documentation is athttps://dj-sessions.readthedocs.org.QuickstartInstall dj-sessions:pip install dj-sessionsThen use it in a project:import djsessionsFeaturesTODORunning TestsDoes the code actually work?source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install -r requirements_test.txt
(myenv) $ python runtests.pyCreditsTools used in rendering this package:Cookiecuttercookiecutter-djangopackageHistory0.4.0 (2016-08-06)Orphan removal0.1.0 (2016-07-06)First release on PyPI.
Package: dj-settings
dj_settingsoffers way to add project settings in a way
that has been battle-tested for years in numerous UNIX apps,
reading from the value/etc/<conf_path>or~/.config/<conf_path>or<proj_path>/<conf_path>or anENV VAR, allowing overriding
from the next read location.  It’s mainly targeting django, but it can be
used as a general settings parserIn a nutshellInstallationThe easiest way is to usepoetryto manage your dependencies and adddj_settingsto them.[tool.poetry.dependencies]dj_settings="^4.2.1"Usagedj_settingswill read from various config files to get the value of a variable,
in a way that’s very familiar to all UNIX users. It allows setting default values,
and overriding with ENV VARs and .d directories.LinksDocumentationChangelog
Package: dj-settings-helpers
Simple helpers for setting up your Django settings fileUsageInside yoursettings.pyfile, do the following:from dj_settings_helpers import create_project_dir, get_env
project_dir = create_project_dir(__file__)Now, you can useproject_dirto generate paths relative to yoursettings.pyfile andget_envto load environment variables.For example, you can use it to add yourproject_root/templatesdirectory to yourTEMPLATES_DIRSsetting like this:TEMPLATES_DIRS = (
    project_dir('templates'),
)You can use theget_envvariable to pull in environment variables with
defaults that depend on theENVIRONMENTvariable.  For example, you can set
multiple defaultBROKER_HOSTvariables for Celery like this:BROKER_HOST = get_env('BROKER_HOST', 'default.rabbitmq.example.com',
        dev='localhost', staging='staging.rabbitmq.example.com')If yourENVIRONMENTvariable is equal todev, thelocalhoststring
is used; if set tostaging, it isstaging.rabbitmq.example.com, and all
other environments usedefault.rabbitmq.example.com.  All of these are
overridden by the presence of an environment variable namedBROKER_HOST.Please see the inline documentation indj_settings_helpers.pyfor full
examples and usage.Installationpip install dj-settings-helpersLicenseCopyright 2012 Travis SwicegoodLicensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Package: dj-shop-cart
dj-shop-cartA simple and flexible cart manager for your django projects.✨📚✨Read the full documentationFeaturesAdd, remove, decrement and clear items from cartAuthenticated users cart can be saved to databaseWrite custom methods to easily hook into the items add / remove flowCustomget_pricemethod to ensure that the cart always have an up-to-date products priceEach item in the cart hold a reference to the associated productMetadata data can be attached to cart itemsSupports specification of product variation detailsAvailable context processor for easy access to the user cart in all your django templatesSwappable backend storage, with session and database provided by defaultInstallationInstalldj-shop-cartwith pip or poetry.pipinstalldj-shop-cartQuickstart# settings.pyTEMPLATES=[{"OPTIONS":{"context_processors":[...,"dj_shop_cart.context_processors.cart",# If you want access to the cart instance in all templates],},}]# models.pyfromdjango.dbimportmodelsfromdj_shop_cart.cartimportCartItemfromdj_shop_cart.protocolsimportNumericclassProduct(models.Model):...defget_price(self,item:CartItem)->Numeric:"""The only requirements of the dj_shop_cart package apart from the fact that the products you addto the cart must be instances of django based models. You can use a different name for this methodbut be sure to update the corresponding setting (see Configuration). Even if you change the name thefunction signature should match this one."""# views.pyfromdj_shop_cart.cartimportget_cart_classfromdjango.httpimportHttpRequestfromdjango.views.decorators.httpimportrequire_POSTfromdjango.shortcutsimportget_object_or_404from.modelsimportProductCart=get_cart_class()@require_POSTdefadd_product(request:HttpRequest,product_id:int):product=get_object_or_404(Product.objects.all(),pk=product_id)quantity=int(request.POST.get("quantity"))cart=Cart.new(request)cart.add(product,quantity=quantity)...@require_POSTdefremove_product(request:HttpRequest):item_id=request.POST.get("item_id")quantity=int(request.POST.get("quantity"))cart=Cart.new(request)cart.remove(item_id=item_id,quantity=quantity)...@require_POSTdefempty_cart(request:HttpRequest):Cart.new(request).empty()...Used ByThis project is used by the following companies:Fêmy bien êtreDevelopmentPoetry is required (not really, you can set up the environment however you want and install the requirements
manually) to set up a virtualenv, install it then run the following:poetryinstall
pre-commitinstall--install-hooksTests can then be run quickly in that environment:pytestFeedbackIf you have any feedback, please reach out to me attobidegnon@proton.me.CreditsThanks toJetbrainsfor providing an Open Source license for this project.
Package: dj_sinp_organisms
DjangoSinpOrganismsis a simpleDjangoreusable app to manageFrench SINP Organisms, respecting standard.Detailed documentation is in the “docs” directory.Quick startInstall app$pipinstall-Udj-sinp-organismsConfigureINSTALLED_APPS:INSTALLED_APPS=('django.contrib.admin','django.contrib.auth',(...),'rest_framework','sinp_nomenclatures','sinp_organisms',(...),)Configureurls.py:urlpatterns=[path('admin/',admin.site.urls),path('api-auth/',include('rest_framework.urls')),(...),path('api/v1/',include('sinp_nomenclatures.urls')),path('api/v1/',include('sinp_organisms.urls')),(...),]Runpython manage.py migrateto create the polls models.Start the development server and visithttp://127.0.0.1:8000/admin/to create an organism (you’ll need the Admin app enabled).Visithttp://127.0.0.1:8000/api/v1/organismsto view organisms API.
Package: dj-snake
Installing fixtures with django’sloaddatacommand overrides objects with the same primary key.
While this is not a problem if you are installing the fixtures against a fresh DB with no data but in case you have
existing data then loading the fixture can be problematic as all the existing rows with the same primary key will be updated
with the new data from the fixture(s)
Usingdjloaddatato install fixture ensures that no existing rows will be touched and all the objects will only be inserted
while preserving all the relations between model objects.RequirementsPython 3.6 to 3.10 supported.Django 2.2 to 4.0 supported.InstallationFirst,install with pip:python-mpipinstalldj-snakeSecond,add the app to yourINSTALLED_APPSsetting:INSTALLED_APPS=[...,"dj_snake",...,]The app adds a new management command nameddjloaddata.Usagepythonmanage.pydjloaddatafixture[fixture...]
Package: djsnowpack
Snowpack is the fastest and easiest way ever to benefit from npm and imports in
frontend code without going full SPA.What this doesMUCH faster frontend development !ElectedProductivity Booster OS Award 2020, Snowpack is a frontend builder with a
startup time of 50ms, which typically can be 30s in a typical Webpack project.
It’s so fast I feel like a 300.000% speedup (from 30 to less than 1 second).Change your CSS or JS and your Django page will reload !Changing a frontend file will typically not cause a Django view reload because
Django doesn’t want to provide JS by default: djsnowpack provides a solution
for that.Demo# go and make a virtualenv in /tmpcd/tmpvirtualenv/tmp/djsnowpack_demosource/tmp/djsnowpack_demo/bin/activate# clone and install the app and example projectgitclonehttps://yourlabs.io/oss/djsnowpackcddjsnowpackpipinstall.# install example project dependencies and start servercddjsnowpack_examplepipinstalldjangoyarninstall./manage.pyrunserverThe green title at the top left of the Django demo page should say “djsnowpack
working fine !!!” because that’s what the djsnowpack_example/index.js is like,
try to change index.js and see the browser magically update in a heartbeat !Getting startedInstall:pip install djsnowpack,Add tosettings.MIDDLEWARE:djsnowpack.Middleware,Add tosettings.STATICFILES_DIRS:os.path.join(BASE_DIR, 'build').This allows you to have a Snowpack frontend project inside yoursettings.BASE_DIR.You should see a minimal example indjsnowpack_exampledirectory:package.json: get one from atemplate project,
minimal one is good to just get going without any specific framework or libraryindex.html: snowpack needs it to work so you’ll just put it there once and
then forget about itindex.js: this is the entrypoint that will be served by snowpackindex.css: same but optional and for styles, sass works well with
snowpack tooDANGER: you MUST have the following in your index.html to make Django view
reload on JS change:if(import.meta.hot){import.meta.hot.accept(({module})=>{import.meta.hot.invalidate();});}index.html content:<!DOCTYPE html><htmllang="en"><head><linkrel="stylesheet"type="text/css"href="/index.css"/></head><body><scripttype="module"src="/index.js"></script></body></html>
Package: dj-soft-delete
Soft DeleteThis package is used for implementing soft delete functionality in models,
when used you can delete and restore deleted items unless it was hard deleted from the database.Installationpip install dj-soft-deleteUsageyou can use it by extendingHasSoftDeleteclass in your modelfrom django_soft_delete.models import HasSoftDelete
    
    
    class Item(HasSoftDelete):
        ...retrieving items without deletedItem.objects.all()retrieving items with deletedItem.with_trashed_objects.all()**retrieving deleted items onlyItem.with_trashed_objects.deleted()Soft deleting item# via objects manager
    Item.objects.filter(...).delete()

    # via model instance
    item = Item.objects.get(...)
    item.delete()herd deleting items# via objects manager
    Item.objects.filter(...).hard_delete()

    # via model instance
    item = Item.objects.get(...)
    item.hard_delete()Restore soft deleted items# via objects manager
    Item.with_trashed_objects.filter(...).restore()
    
    # via model instance
    item = Item.with_trashed_objects.get(...)
    item.restore()
Package: djsommo
djsommoDjango safe optional modelMetaoptions.Django doesn't support adding third-party fields to the model class Meta.
It raises an exception if one is encountered.Many installable apps inject a modelMetaoption name into Django
during initialisation, after which it is safe to use them.However what happens if the installable app isnt working for some reason,
and you want to disable it.Then you need to remove all use of theMetaoption from the models.This app provides aMetaclass which detects unknown options,
issues a warning and discards them before Django can raise an exception.UsageInmodels.pyfromdjango.dbimportmodelsfromdjsommoimportSafeOptionalMetaclassMyModel(models.Model):uuid=models.TextField()...classMeta(SafeOptionalMeta):unknown_option=True
Package: djson
WTF-_-# :importjsonjson.loads(r"""{"a": "good", 123: "fuck!", false: "fuck!!", null: "fuck!!!"}""")^_^ :importdjsondjson.loads(r"""{"a": "good", 123: "well done!", true: "excellent!!", null: "I love djson!!!"}""")Installationpip install djsonAPIsload(str) -> dict()loads(file) -> dict(): file is a iterable file-like object.dump(obj, file=sys.stdout, encoder=JSONEncoder): Rewrite JOSNEncoder to support custom object.NOTE: returned string must like this:'"string"'.dumps(obj, encoder=JSONEncoder) -> strExamplesSeeexamples/LICENSEThe BSD 3-Clause License
Package: djspa
djspaDjango addon for a single page application with dynamically loaded pagesInstallationUse the python package manager pip to install djutils.pipinstalldjspaUsageAdd 'djspa' to INSTALLED_APPS at the endINSTALLED_APPS=[...'djspa',]Mark your BasePage (Template Class from that all other templates inherit) with the
@set_baseview decorator of djspafromdjango.viewsimportgenericfromdjspaimportset_baseview@set_baseviewclassBaseView(generic.TemplateView):defget_context_data(self,**kwargs):context=super().get_context_data(**kwargs)context['my_global_template_variable']=42returncontextDefine your dynamic pages by a class, which inherits from your BaseView and the PageMixin.
You have to set at least thenameproperty, which is the name of the template and also the url.Import the djspa urlpatterns after you defined all viewsfrom djspa.urls import urlpatterns # pylint:disable=C0411; urlpatterns of djspa MUST be loaded after all view definitionsYou have to define at least the index page, otherwise you get an endless redirect loop.fromdjspaimportPageMixinclassIndex(BaseView,PageMixin):name='index'Include the pages snippet in your index page template{% include 'djspa_pages.html' %}LicenseGNU GPLv3, see LICENSEMaintainerThis package is maintained by Manuel Stingl.
For more information seehttps://opensource.voltane.eu
Package: dj-spam
Django + Flagging Spam Made EasyDocumentationThe full documentation is athttps://dj-spam.readthedocs.org.FeaturesFor Django 1.8+For Python 2.7/3.3+Direct foreign key from the model to the spam report. Avoiding content types and using explicit foreign keys makes for less kludgy databases.Powered by conventions used all over Django:Have the appropriate__str__()or__unicode__()method on your models.Flaggable models should haveget_absolute_url()methods.QuickstartInstall dj-spam:pip install dj-spamConfigure it into your project:# settings.py
INSTALLED_APPS += ['spam', ]# urls.py
url(r'^spam/', include('spam.urls', namespace='spam')),For any model you want to flag:from spam import Spammable

class MyModel(Spammable, models.Model):
    # Define your model here. Spammable attaches
    #   the spam_flag field to your model as a ManyToManyField.

    @models.permalink
    def get_absolute_url(self):
        # Not required, but it allows dj-spam to link back to the offending
        # content in the report spam view.
        return 'absolute link to model detail view'Run Migrations./manage migrateThen, in the model’s related view:from spam import SpammableMixin

class MyModelDetailView(SpammableMixin, DetailView):
    class = MyModelThis empowers you with the view methodspam_report_urlwhich you can use to
define the URL to the reporting form:<a href="{{ view.spam_report_url }}">Report Spam</a>admindj-spam comes with a simple admin view.emailing managersdj-spam emailssettings.MANAGERSevery time something is flagged. If you don’t
setsettings.MANAGERS, it will emailsettings.ADMINS.History0.2.0 (2-15-07-29)Added admin functionality.Fixed broken spam report form.Email of managers when content is flagged as spam.0.1.0 (2-15-07-28)First release on PyPI.
Package: dj-static
This is a simple Django middleware utility that allows you to properly
serve static assets from production with a WSGI server like Gunicorn.Djangodoesn’t recommendthe production use of its static file server for a number of reasons.
There exists, however, a lovely WSGI application aptly namedStatic.It is suitable for the production use of static file serving, unlike Django.UsageConfigure your static assets insettings.py:STATIC_ROOT = 'staticfiles'
STATIC_URL = '/static/'Then, update yourwsgi.pyfile to use dj-static:from django.core.wsgi import get_wsgi_application
from dj_static import Cling

application = Cling(get_wsgi_application())
Package: dj-static-incuna
This is a simple Django middleware utility that allows you to properly
serve static assets from production with a WSGI server like Gunicorn.Djangodoesn’t recommendthe production use of its static file server for a number of reasons.
There exists, however, a lovely WSGI application aptly namedStatic.It is suitable for the production use of static file serving, unlike Django.UsageConfigure your static assets insettings.py:STATIC_ROOT = 'staticfiles'
STATIC_URL = '/static/'Then, update yourwsgi.pyfile to use dj-static:from django.core.wsgi import get_wsgi_application
from dj_static import Cling

application = Cling(get_wsgi_application())
Package: dj-static-jl
This is a modification of the original dj-static by Kenneth Reitz (https://pypi.python.org/pypi/dj-static)This is a simple Django middleware utility that allows you to properly
serve static assets from production with a WSGI server like Gunicorn.Djangodoesn’t recommendthe production use of its static file server for a number of reasons.
There exists, however, a lovely WSGI application aptly namedStatic.It is suitable for the production use of static file serving, unlike Django.UsageConfigure your static assets insettings.py:STATIC_ROOT = 'staticfiles'
STATIC_URL = '/static/'Then, update yourwsgi.pyfile to use dj-static:from django.core.wsgi import get_wsgi_application
from dj_static import Cling

application = Cling(get_wsgi_application())or:from django.core.wsgi import get_wsgi_application
from dj_static import Cling
import static

class BaseCling(static.Cling):
    ...

application = Cling(get_wsgi_application(), cling_class=BaseCling)