Saravanan666/pypi-org huggingface dataset:
Package: django-launchd
Installation$[sudo]pipinstalldjango-launchdsettings.pyINSTALLED_APPS=["django_launchd",]Modelsmodel__doc__django_launchd.models.Plistlaunchd.plist model. fields:pathdjango_launchd.models.Locklaunchd.plist Lock class. fields:plist(ForeignKey),keyExamplesinitimportdjango_launchdfromdjango_launchd.modelsimportPlistfiles=django_launchd.files("~/Library/LaunchAgents")forfinfiles:Plist.objects.get_or_create(path=f)Plist.objects.exclude(path__in=files).delete()locksforagentinfilter(lambdaa:a.exists,Plist.objects.all()):if<condition>:agent.lock("key")else:agent.unlock("key")load/unloadforagentinfilter(lambdaa:a.exists,Plist.objects.all()):ifagent.locks:agent.unload()else:agent.load()django-readme-generator
Package: django-launch-page
django-launch-page==================A launch page for a Django project to collect e-mail addresses and more.Master Build Status-------------------[![Build Status](https://travis-ci.org/RyanBalfanz/django-launch-page.png?branch=master)](https://travis-ci.org/RyanBalfanz/django-launch-page)Develop Build Status--------------------[![Build Status](https://travis-ci.org/RyanBalfanz/django-launch-page.png?branch=develop)](https://travis-ci.org/RyanBalfanz/django-launch-page)Installing `launch_page` to you Django project will give you a simple teaser page for collecting e-mail addresses, names, and IP addresses.The IP address can be geolocated with GeoIP. For more information, see the GeoIP documentation.Installation------------Install from PyPI:pip install django-launch-pageAdd `launch_page` to your `INSTALLED_APPS`:INSTALLED_APPS = (...'launch_page',)Include the `launch_page` URLconf in your project urls.py like this:urlpatterns = patterns('',...url(r'^launch_page/', include('launch_page.urls')),)or, bind it to the root domain:from launch_page.urls import launch_page_urlpatternsurlpatterns += launch_page_urlpatternsMigrate the application:python manage.py migrate launch_pageThe use of custom templates is similar to overriding admin templates.Contributing------------Create a new virtualenv:mkvirtualenv <env_name>First, set some environment variables:export DJANGO_SETTINGS_MODULE=example_project.settings.localexport DJANGO_DEBUG=true # Or unset DJANGO_DEBUG to disableexport DJANGO_SECRET_KEY='your_secret_key'Add the repository root to your `PYTHONPATH`export PYTHONPATH=`pwd`:$PYTHONPATHor, create a new build and install it to your virtualenvmake releasecd dist/tar -xzvf django-launch-page-<version>cd django-launch-page-<version>/python setup.py installRun the example project with either Foreman or the devserverforeman startpython example_project/manage.py runserverTesting across multiple Python versions is support with tox. To run the tests with tox:make test_tox[GeoIP]: https://docs.djangoproject.com/en/dev/ref/contrib/gis/geoip/[tox]: http://tox.readthedocs.org/en/latest/[Overriding admin templates]: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates
Package: django-layar
Django generic view for makingLayarendpoints.Provides abstract class that responds to Layar API requests in the appropriate format.  By implementing two small functions it is possible to add a layer to the Layar augmented reality application for Android and iPhone.django-layar is a project of Sunlight Labs (c) 2010.
Written by James Turk <jturk@sunlightfoundation.com>Source:http://github.com/sunlightlabs/django-layar/Documentation:http://packages.python.org/django-layar/README.html
Package: django_lazy_admin
Django’s automatic admin list screens are awesome! But sometimes you
need custom columns to display information that requires some big
queries or perhaps some heavy computation. This can slow down displaying
the entire list screen. This app is meant to address that need by
converting a custom column in to one that can be dynamically loaded over
AJAX on user action.Regular custom columnDjango allows you to use admin methods to render a column on the change
list screen. For example:classMyAdmin(admin.ModelAdmin):list_display=('name','age','custom_column')defcustom_column(self,obj):returnfoo_takes_time(obj)custom_column.short_description='Custom Title'Lazy custom columnLazy custom columns are loaded over AJAX by user action. This is
achieved by adding a decorator over any custom list column function
you’ve added in your ModelAdmin class.fromlazy_adminimportlazy_admin_columnclassMyAdmin(admin.ModelAdmin):change_list_template='lazy_admin/change_list.html'list_display=('name','age','custom_column')@lazy_admin_columndefcustom_column(self,obj):returnfoo_takes_time(obj)custom_column.short_description='Custom Title'Note the change_list_template of the MyAdmin class. This template
loads the javascript necessary to handle the AJAX interaction.InstallIdeally, install the package in your virtual environment.pip install django_lazy_adminNow, add the app to your django setting INSTALLED_APPS.INSTALLED_APPS=('...','lazy_admin')And, install the URL handler in your root url conf or in some other url
configuration file.urlpatterns=patterns('','...',url(r'^admin/lazy/',include('lazy_admin.urls')),)And, you’re done!ConfigurationYou can turn off all lazy columns by the following in your main django
settings.py file.LAZY_ADMIN_ALLOW=FalseThe column content is rendered using the lazy_admin/lazy_column.html
template. You can over-ride this in your own app. Or you can use a
parameter to the decorator.@lazy_admin_column(template='my_custom_template.html')TODOSupport Model class methods used as custom columns as well with the
same decorator.AuthorsThe primary author of this package is Gautam Kachrugautam@live.inLicenseBSD 3-clause. See LICENSE file.
Package: django-lazydrf
django-lazydrfis a dirty magic applied to your models to generate
automatedDjango Rest Frameworkendpoints.Notethat this is an experimental project. Use at your own risk and sadness.TODO: Provide a complete READMEInstallationpip install django-lazydrfUsageDefine a Django model as follows:from django.db import models
from django.db.models import CharField

from lazydrf.models import LDRF


class Record(models.Model, metaclass=LDRF):
    """
    Defines a key/value record model.
    """

    #: Defines the key of the record.
    key = CharField(max_length=16, unique=True, blank=False, null=False)

    #: Defines the value of the record.
    value = CharField(max_length=64, blank=False, null=False, db_index=True)

    class Meta:
        """
        Defines Django model metadata.
        """
        app_label = "sample"

    class APIFields:
        """
        Defines fields related API metadata.
        """
        editable = ["key", "value"]
        ordering = ["key"]
        searching = ["key", "^value"]

    class APIFiltering:
        """
        Defines filtering related API metadata.
        """
        key = ["exact", "icontains", "startswith"]
        value = ["exact", "icontains", "startswith"]

    class APIViewset:
        pass
        #readonly = TrueRegister all lazydrf models for a given Django application to the usual DRF router, like:from django.conf.urls import url, include
from django.contrib import admin
from rest_framework import routers

from lazydrf.utils import register_app


#: Defines the DRF router.
Router = routers.DefaultRouter()

## Register model endpoints for the sample Django application:
register_app("sample", Router)

#: Defines URL patterns:
urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r"^", include(Router.urls)),
]
Package: django-lazy-image
# Django Lazy Image`django-lazy-image` is a small Django utility that allows you to render images lazily on the frontend to minimise initial page load.## InstallationTo install `django-lazy-image` just run:```clipip install django-lazy-image```## Requirements* Jinja2* Django >= 1.11 (It's only been tested on 1.11 but i'm pretty sure it will work on 1.8+)* [Django Jinja](https://github.com/niwinz/django-jinja)## ConfigurationAdd `django_lazy_image` to your `INSTALLED_APPS````pythonINSTALLED_APPS = [...'django_lazy_image',...]```Add `url(r'^assets/', include('django_lazy_image.urls', namespace='assets')),` to your base `urls.py````pythonurlpatterns = [...url(r'^assets/', include('django_lazy_image.urls', namespace='assets')),...```Then there are 2 ways to use the static files with Django:### NPM (The preferred way)You can simply do```clinpm install django-lazy-image```or```cliyarn add django-lazy-image```Then include the Javascript / CSS as a module**file.js**```javascriptimport LazyImage from 'django-lazy-image';// Only run the below code if the page has a lazy image instanceconst lazyImage = document.querySelector('.js-LazyImage')if (lazyImage) {// Collect all the lazy images on the pageconst lazyImages = document.querySelectorAll('.js-LazyImage')// Set up our IntersectionObserver callbackconst callback = (entries, observer) => {Array.from(entries).forEach((entry, index) => {// If any of the images have come in to view, activate them sequentiallyif (entry.isIntersecting && !entry.target.dataset.activating) {entry.target.dataset.activating = truewindow.setTimeout(() => {new LazyImage({ el: entry.target })observer.unobserve(entry.target)}, 150 * index)}})}const observer = new IntersectionObserver(callback, {threshold: 0.4})Array.from(lazyImages).forEach(image => observer.observe(image))}```**file.css**```css@import 'django-lazy-image/dist/css/lazy-image.css';```### Django StaticSomewhere in your `base.html` add:```html{{ static('django_lazy_image/css/lazy-image.css') }}{{ static('django_lazy_image/js/lazy-image.js') }}```You can then use the `lazyImage` function that is on the global object```javascriptvar images = [].slice.call(document.querySelectorAll('.js-LazyImage'))images.forEach(function (el) {var image = window.lazyImage(el)...})```
Package: django-lazy-json
Django Lazy JSON FieldWrapper for Django's JSONField that allows for lazy loading of the JSON object.Why?Django's JSONField is great, but it's not lazy. This means that if you have a large JSON object,
it will be loaded into memory every time you access the field.
This can be a problem if you have a large number of records with large JSON objects.This package provides aLazyJSONFieldthat only loads the JSON object when it's accessed.Installationpipinstalldjango-lazy-jsonUsagefromdjango.dbimportmodelsfromlazy_json_field.fieldsimportLazyJSONFieldclassMyModel(models.Model):data=LazyJSONField()
Package: django-lazyloader
=====Django-Lazyloader=====Django-Lazyloader is a simple Django app which helps displaying Django objects as either HTML or JSON.Quick start-----------1.  Add "lazyloader" to your INSTALLED_APPS setting like this::INSTALLED_APPS = (...'lazyloader',)2.  Include the lazyloader URLconf in your project urls.py like this::url(r'^lazyloader/', include('lazyloader.urls')),3.  Run `python manage.py migrate` to create the demo models.4.  Run `python manage.py loaddata lazyloader_initial.json` to load the initial data for the live demo.5.  Run `python manage.py collectstatic` to collect the static files of the live demo.6.  To allow your models to be displayed by Django-Lazyloader, define a VALID_LAZY_MODELS variable in your settings.pyfile like this::VALID_LAZY_MODELS = ['MyApp.MyModel','MyOtherApp.MyOtherModel',]7.  Create html templates and assign them to your models by adding a LAZY_TEMPLATES variable to your project'ssettings.py file like this::LAZY_TEMPLATES = {'MyApp.MyModel': 'myapp/mylazytemplate.html','MyOtherApp.MyOtherModel': 'myotherapp/myotherlazytemplate.html'}8.  Run the development server and visit http://localhost:8000/lazyloader/demo for the live demo.9.  To access your the first 10 entries of your model 'Myapp.MyModel' in the JSON format visithttp://localhost:8000/lazyloader/myapp-mymodel-json-0-10/10. To access your the first 10 entries of your model 'Myapp.MyModel' in the HTML format visithttp://localhost:8000/lazyloader/myapp-mymodel-html-0-10/11. To create custom queries you can add the get parameters 'column' and 'search_value' to your url:http://localhost:8000/lazyloader/myapp-mymodel-html-0-10/?column=name&search_value=smithThis url will execute a django-query that looks like this::MyApp.MyModel.objects.filter(name=smith)12. The variable that is passed to the templates is called 'models' so if you want to iterate over the queryset in atemplate you have to do it like this::{% for model in models %}{{ model.fieldname }}{% endfor %}
Package: django-lazypage
django-lazypagedjango 页面异步加载解决方案解决由于后端请求处理时间较长导致前端长时间无响应的用户体验问题。效果示例https://tools.athenagu.com/test_slow_page/?s=8使用步骤:1 安装$ pip install django-lazypage2 引入 app# settings.py
INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.admin',
    'myapp',
    'lazypage',  # <--- 引入 app
)3 用 lazypage_decorator 装饰 view# views.py
# -*- coding: utf-8 -*-

import time
from django.http import HttpResponse
from django.shortcuts import render_to_response
from lazypage.decorators import lazypage_decorator  # <--- 引入装饰器

def index(request):
    return render_to_response('index.html', locals())

@lazypage_decorator  # <--- 在原来的 view 上添加 lazypage_decorator 装饰器即可
def test_slow_page(request):
    s = int(request.GET.get('s', 8))
    print(s)
    time.sleep(s)
    return HttpResponse('I am a slow page!')4 配置 urls# urls.py
from django.conf.urls import url, include
from views import *
import lazypage.urls  # <--- 引入 lazypage 路由

urlpatterns = [
    url(r'^$', index),
    url(r'^test_slow_page/$', test_slow_page),
    url(r'^lazypage/', lazypage.urls.get_urls()),  # <--- 添加 lazypage 的路由
]5 migrate# 最后需要跑一次 migrate 创建 LazyStore 表
$ python manage.py migrate完成以上步骤后，访问/test_slow_page/就可以看到效果了进阶配置:可在settings.py中添加 lazypage 配置项，按自己的实际需求设定参数LAZYPAGE = {
    'EXPIRED_SECONDS': 3600,  # 页面最长等待超时，默认 3600 秒，超过还没加载出来的页面，将报错。所以这里建议设置一个足够大的值
    'POLLING_SECONDS': 5,     # 等待加载页面的刷新间隔(秒)，间隔越短越能第一时间看到加载完成后的页面

    'ASYNC_BY_CELERY': False,  # 是否使用 celery 来做生成页面内容的异步任务，默认为否，即使用另开一个线程的方式来实现异步生成页面
    'CELERY_APP': None,  # ASYNC_BY_CELERY 为 True 时生效，这里需要是一个 Celery 实例，或是一个引入实例的路径(如:"myproj.celery.app")
    # 关于 celery 以及在 django 中应用的相关内容可以查看官方文档:
    # http://docs.celeryproject.org/
    # http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html

    'STORE_BY_REDIS': False,   # 是否使用 redis 来存储异步加载出来的页面内容，默认为否，即使用数据库存储
    'REDIS_HOST': '127.0.0.1', # STORE_BY_REDIS 为 True 是生效，redis 的 host 地址
    'REDIS_PORT': '6379',	   # 同上，redis 的端口号
    'REDIS_PASSWORD': '',      # 同上，redis 的连接密码
    'REDIS_DB': '2',           # 同上，redis 使用的库序号
    # 当使用 redis 储存页面内容时，就不必执行 migrate 创建 LazyStore 了
}
Package: django-lazy-services
django-lazy-servicesA helper for switching between test and production versions of a servicePurposeLets you easily switch between versions of a service based on a Django setting entry.
Good for situations where you want to use different versions between production and development and/or test.
In the client code you might use:from . import my_servicewhich might go to either.services.MyServiceor.services.MyFakeServicedepending on the content of your settings.UsageConstruct your service as a class whose init takes no arguments.Inservices.py:classMyService:def__init__(self):passdefhello(self):print("hello world")Declare the service.In__init__.py:fromlazy_servicesimportLazyServicemy_service=LazyService("MY_SERVICE")Select the service.Insettings.pyMY_SERVICE="my_project.services.MyService"Use the service.from.importmy_serivcemy_service.hello()
Package: django-lazy-settings
Django Lazy Settings========================An easy way to use settings variable in django template.How to install--------------You can also install it with: ``pip install django-lazy-settings``Configuration-------------Add the sr app to your installed apps and define your settings :code:`SR` variable as a dictionary.Example:```python# settings.pyINSTALLED_APPS = [...'lazy_setting']```Usage examples--------------Use it from your template code with ``lz`` template tag:```django{% load lazy_setting %}<span class="message">{% lz 'SETTING_KEY' %}</span><span class="other">{% lz 'SECRET_KEY' %}</span>```
Package: django-lazy-tags
A Django app for easily loading template tags via AJAX.Installation1. Install via pippipinstalldjango-lazy-tags2. Add to installed appsINSTALLED_APPS=(# ...'lazy_tags',)3. Add the lazy tags urls to your root urlconf.urlpatterns=patterns('',# ...url(r'^lazy_tags/',include('lazy_tags.urls')),)UsageFirst, load thelazy_tagslibrary in your templates.{%loadlazy_tags%}Then, call thelazy_tagtemplate tag passing your tag name as the first parameter. The format istag_library.tag_namewheretag_libraryis what you would load at the top of the page (e.g.my_tags) andtag_nameis the name of your template tag (e.g.my_template_tag). After the first argument tolazy_tagsimply pass the rest of the args and kwargs just as you would pass them to your own tag.This:{%loadmy_tags%}{%my_template_tagarg1arg2kw1='hello'kw2='world'%}Becomes this:{%loadlazy_tags%}{%lazy_tag'my_tags.my_template_tag'arg1arg2kw1='hello'kw2='world'%}After placing your template tags in the template you still need to specify where you would like the AJAX JavaScript to output to the page. That is what thelazy_tags_jstag is for:{%blockjs-additional%}{%lazy_tags_js%}{%endblock%}This will spit out the JavaScript required to run the AJAX. The JavaScript changes depending on yourLAZY_TAGS_AJAX_JSsetting.The lazy_tag decoratordjango-lazy-tags also includes a decorator that can be used on template tags that usesimple_tag. When using thelazy_tagdecorator you can use your template tags exactly the same as before and they will use AJAX.fromlazy_tags.decoratorsimportlazy_tag@register.simple_tag@lazy_tagdefshow_user(pk):user=User.objects.get(pk=pk)returnrender_to_string('user/show_user.html',{'user':user,})There are a few caveats with this method. First, the decorator currently only works with tags that usesimple_tag. Hopefully this will work withinclusion_tagin the future. Secondly, thelazy_tagdecorator must comeafterthesimple_tagdecorator.SettingsLAZY_TAGS_AJAX_JSThe library to use to run AJAX. Options are'javascript','jquery', or'prototype'. Defaults to'jquery'.LAZY_TAGS_CACHE_TIMEOUTThe timeout on each lazy tag cache. Defaults to60(seconds).LAZY_TAGS_ERROR_MESSAGEThe error message to display if the AJAX request fails. Defaults to'An error occurred.'Customizing the Loading AnimationThis is the default HTML on the page before the AJAX request completes:<divid="{{ tag_id }}"class="lazy-tag"><divclass="lazy-tag-spinner-container"style="width: 100%; text-align: center;"><imgid="{{ tag_id }}-spinner"class="lazy-tag-spinner"style="width: 15px; height: 15px;"src="{static_url}img/lazy_tags/spinner.gif"/></div></div>To customize the loading animation, override thelazy-tag,lazy-tag-spinner-container, orlazy-tag-spinnerclasses in your CSS.Current LimitationsDoes not work with tags that take context.Template tag arguments must be serializable (str, unicode, int, float, etc.).
Package: django-lbattachment
A Django APP used to manager attachment.django-lbattachmentsupportsDjango1.7.0 and later on Python 2.7,
3.2, 3.3 and 3.4.Getting HelpDocumentation for django-lbattachment is available athttps://django-lbattachment.readthedocs.org/ContributingPlease file bugs and send pull requests to theGitHub repositoryandissue
tracker.
Package: django-lb-health-check
Django Load Balancer Health CheckAliveness check for Django that bypasses ALLOWED_HOSTS for the purposes of load balancersPurposeWhen running on some app platforms and behind some load balancers, it is often the case that the host header is not set appropriately for health checks. When these platforms perform an HTTP health check without the proper host header anerror 400 bad requestwill be returned by Django. This package provides a method to allow for for a simple "aliveness" health check that bypasses theALLOWED_HOSTSprotections.ALLOWED_HOSTSprotection is bypassed only for the status aliveness check URL and not for any other requests.This package is not an alternative to something likedjango-health-check, but is instead a better alternative than the TCP health check that is the default on many load balancers. The TCP health checks can only see if your uWSGI/Gunicorn/Uvicorn/etc server is alive, while this package ensures that requests are being properly routed to Django.How it worksThis package works by returning an HTTP response from a middleware class before Django's common middleware performs the host check and before the security middleware does HTTPS checks. The Django URL routing system is also bypassed since that happens "below" all middleware. During request processing,django-lb-health-checkchecks if the request is aGETrequest and matchessettings.ALIVENESS_URL. If it is, a static plain text "200 OK" response is returned bypassing any other processing.UsageInstalldjango-lb-health-checkpipinstalldjango-lb-health-checkAddlb_health_checkto your middleware at the top position. Itmustbe abovedjango.middleware.common.CommonMiddlewareand in most cases should be abovedjango.middleware.security.SecurityMiddleware. Security middleware does things like check for HTTPS, which is often missing in health checks from load balancers. Common middleware does the checks against ALLOWED_HOSTS.MIDDLEWARE=['lb_health_check.middleware.AliveCheck',#  <- New middleware here'django.middleware.security.SecurityMiddleware','django.contrib.sessions.middleware.SessionMiddleware','django.middleware.common.CommonMiddleware','django.middleware.csrf.CsrfViewMiddleware','django.contrib.auth.middleware.AuthenticationMiddleware','django.contrib.messages.middleware.MessageMiddleware','django.middleware.clickjacking.XFrameOptionsMiddleware',]Set the URL you want to use for your aliveness check. Note that a GET request to this URLwillshadow any other route you have defined through the Django URL mapper. Aliveness URL can be a string for a single health check URL or a list of strings if you want the aliveness check to run from multiple URLs. The multiple URL strategy is helpful if you are changing the URL of the endpoint by allowing both the old and new URLs to be checked.ALIVENESS_URL="/health-check/"Test your health check after starting your server:curllocalhost:8000/health-check/
OKNote that the example app haslb_health_checkin INSTALLED_APPS. This is only necessary for testing purposes - the app does not use any Django models, admin, views, URL routing, or the like that would require it to be listed in INSTALLED_APPS.
Package: django-lbutils
A set of useful utils for Django.django-lbutilssupportsDjango1.6.0 and later on Python 2.7,
3.2, 3.3 and 3.4.Getting HelpDocumentation for django-lbutils is available athttps://django-lbutils.readthedocs.org/ContributingPlease file bugs and send pull requests to theGitHub repositoryandissue
tracker.
Package: django-lc-polls
Polls is a simple Django app to conduct Web-based polls. For each
question, visitors can choose between a fixed number of answers.Detailed documentation is in the “docs” directory.Quick startAdd “polls” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'polls',
]Include the polls URLconf in your project urls.py like this:path('polls/', include('polls.urls')),Runpython manage.py migrateto create the polls models.Start the development server and visithttp://127.0.0.1:8000/admin/to create a poll (you’ll need the Admin app enabled).Visithttp://127.0.0.1:8000/polls/to participate in the poll.
Package: django-lc-utils
Django LC UtilsDjango app for various django utilitiespip install django-lc-utilsPrerequisitesThis package relies ondjango-model-utils,Django.Running Testspython manage.py testUsuageIn order to use the system you must add django_lc_utils to your installed apps in your settings.py file.INSTALLED_APPS=['django_lc_utils']UtilitiesDjango Soft Delete MixinThis is a custom mixin to enable soft delete feature on the Django models.fromdjango_lc_utils.mixinsimportSoftDeleteMixinfrommodel_utils.modelsimportTimeStampedModelclassTestModel(TimeStampedModel,SoftDeleteMixin):classMeta:db_table="test_model"verbose_name="Django Test Model"verbose_name_plural="Djando Test Models"test_field=models.TextField("Test field")