Saravanan666/pypi-org huggingface dataset:
Package: django-image-optimizer
django-image-optimizerDjango Image Optimizer is a simple Django library that allows optimization
of images by usingTinyPNGorPillow.InstallationDjango Image Optimizer is available directly fromPyPI:Installing the package.$ pip install django-image-optimizerDon’t forget to add'image_optimizer'to your'INSTALLED_APPS'.# settings.py
INSTALLED_APPS = [
    ....
    'image_optimizer',
]You have the option to use either TinyPNG or Pillow for optimizing images.
Informoptimized_imagewhich one you want to use by setting the following# To use Pillow
OPTIMIZED_IMAGE_METHOD = 'pillow'
# To use TinyPNG
OPTIMIZED_IMAGE_METHOD = 'tinypng'Any other string that is set for this setting will mean that optimization does
not occur. If you are unsure of whether you would like to use TinyPNG or Pillow,
feel free to consult the documentation of each.If you choose to use TinyPNG, you will need to get an API key from
TinyPNG. Visithttps://tinypng.com/developersfor more details on getting an
API key. Once you have done so, add the following setting to your settings
file. Note: it is a good idea to keep this secretTINYPNG_KEY = 'your-key'You may use theOptimizedImageFieldby importing itfrom django.db import models

from image_optimizer.fields import OptimizedImageField


class MyModel(models.Model):
    ...
    image = OptimizedImageField()


class MyModel2(models.Model):
    """
    If you using OPTIMIZED_IMAGE_METHOD = 'pillow'
    You can use this optional arguments.

    This model represents a MyModel2 with a few
    fields including a `image` field which is an OptimizedImageField
    instance with `optimized_image_output_size` and
    `optimized_image_resize_method` arguments set.

    This means that image would be a resized
    version of the source image, meant to keep a given screen resolution,
    in this case (400, 300) pixels.
    """
    image = OptimizedImageField(
        upload_to="uploads/%Y/%m/%d",
        optimized_image_output_size=(400, 300),
        optimized_image_resize_method="cover"  #  "crop", "cover", "contain", "width", "height", "thumbnail" or None
    )and saving images into it, the same way you would to a DjangoImageField.
The optimized image will be saved into theurlfield in place of the
unoptimized image.Or you can directly use theimage_optimizerfunction from utils.from image_optimizer.utils import image_optimizer


def post_image(request):
    image_data = request.FILES.get('image')
    image_data = image_optimizer(image_data=image_data,
                                 output_size=(400, 300),
                                 resize_method='cover')
    ....P.S:Note about TinyPNG API keys: If you obtain the free TinyPNG API token, you are limited to 500
image optimizations per month, so this function may fail if you have a
lot of images. You may either obtain a paid API key, or wait until next month.This project forked from:https://github.com/dchukhin/django_optimized_image
Package: django-image-optimizer-way2enjoy
django-image-optimizer-way2enjoy |pypi version|---------------------------------------.. |pypi version|image:: https://img.shields.io/pypi/v/django-image-optimizer-way2enjoy.svg?style=flat-square:target: https://pypi.python.org/pypi/django-image-optimizer-way2enjoy.. image:: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square:target: https://raw.githubusercontent.com/agusmakmun/django-image-optimizer-way2enjoy/master/LICENSE.. image:: https://img.shields.io/pypi/pyversions/django-image-optimizer-way2enjoy.svg?style=flat-square:target: https://pypi.python.org/pypi/django-image-optimizer-way2enjoy.. image:: https://img.shields.io/badge/Django-1.8,%201.9,%201.10,%201.11,%202.0-green.svg?style=flat-square:target: https://www.djangoproject.comDjango Image Optimizer is a simple Django library that allows optimizationof images by using `way2ENJOY <https://way2enjoy.com/>`_ or `Pillow <pillow.readthedocs.io/>`_.Installation------------------------------Martor is available directly from `PyPI <https://pypi.python.org/pypi/django-image-optimizer-way2enjoy>`_:1. Installing the package.::$ pip install django-image-optimizer-way2enjoy2. Don't forget to add ``'image_optimizer'`` to your ``'INSTALLED_APPS'``.::# settings.pyINSTALLED_APPS = [....'image_optimizer',]3. You have the option to use either way2ENJOY or Pillow for optimizing images.Inform ``optimized_image`` which one you want to use by setting the following::# To use way2ENJOYOPTIMIZED_IMAGE_METHOD = 'way2enjoy'Any other string that is set for this setting will mean that optimization doesnot occur. If you are unsure of whether you would like to use way2ENJOY or Pillow,feel free to consult the documentation of each.If you choose to use way2ENJOY, you will need to get an API key fromway2ENJOY. Visit https://way2enjoy.com/developers for more details on getting anAPI key. Once you have done so, add the following setting to your settingsfile. Note: it is a good idea to keep this secret::WAY2ENJOY_KEY = 'your-key'4. You may use the ``OptimizedImageField`` by importing it::from django.db import modelsfrom optimized_image.fields import OptimizedImageFieldclass MyModel(models.Model):...image = OptimizedImageField()and saving images into it, the same way you would to a Django ``ImageField``.The optimized image will be saved into the ``url`` field in place of theunoptimized image.Note about way2ENJOY API keys: If you obtain the free way2ENJOY API token, you are limited to 500image optimizations per month, so this function may fail if you have alot of images. You may either obtain a paid API key, or wait until next month.This project also taken from: https://github.com/dchukhin/django_optimized_image
Package: django_image_proxy
Simple django app which provide images from remote hosts. Supports custom sizes and simple caching for less API calls.Aims to simplicity and compatibility with Openstack Horizon Dashboard, where is main place for usage.SupportsDjango 1.7 and olderOpenstack Horizon Dashboard Icehouse, Juno +Pillow 2.3.0Installationpipinstalldjango_image_proxylocal_settings.pyINSTALLED_APPS+=('image_proxy',)IMAGE_PROXY_URL='http://localhost:9753/images'# optionaly set own dir for thumbnailsTHUMBNAILS_DIR="thumbnails"# disable cachingIMAGE_PROXY_CACHE=False# change thumbnail formatTHUMBNAILS_FORMAT="PNG"urls.pyurlpatterns=patterns('',...url(r'^images/',include('image_proxy.urls')),...)Usage<imgsrc="{% url 'proxy_image' '/media/anotherdjangoapp.png' %}"/><imgsrc="{% url 'proxy_image_preview' '/media/anotherdjangoapp.png' %}"/><imgsrc="{% url 'proxy_image_size' 'my_image_name' '100x100' %}"/><imgsrc="{% url 'proxy_image_full' 'my_image_id' '100x100' 'scale' %}"/>or
{% load thumnail %}
{% thumbnail product.image %}
{% thumbnail product.image '400x400' %}
{% thumbnail product.image '400x400' 'crop' %}If you have clash between your favourite thumbnail provider and proxy thumbanil tags use{% load thumbnail from proxy_thumbnail %}.Custom size and methodhttp://<hostname>/<path_to_source_file>/<size>/<method>/For easily using Django Rest Framework should do thislocal_settings.pyIMAGE_PROXY_URL='localhost:9753'note: this url is for another django located on the address# simple using Django Rest Framework Serializer# for image paths return something like thisimages=["/media/image.jpg","/media/image01.jpg"]forimageinimages:printreverse("proxy_image",args=[image])/images/image/media/image.jpg# this url download image from original url and returns it !Usage with Openstack Horizon DashboardRequires installed horizon.Image in modal dialog.<ahref="{% url 'proxy_image_preview' image %}"class="ajax-modal"><imgsrc="{% thumbnail product.image '100x100' 'crop' %}"class="center-block"width="100px"/></a>Overridefromimage_proxy.viewsimportThumbnailViewclassMyThumbnailView(ThumbnailView)defget(self,request,*args,**kwargs):response=http.HttpResponse(self.image,content_type=self.content_type)returnresponseContributionCheck for open issues or open a fresh issue to start a discussion around a feature idea or a bug.Forkhttps://github.com/michaelkuty/django_image_proxyon GitHub to start making your changes to themasterbranch.Send a pull request
Package: django-image-renderer
Django image renderer is an app that will help you render images in many
sizes (renditions). This can be really helpful for generating images
size for different screens resolution (especially when targeting
mobile).FeaturesusesPillowto resize
imagesuses Django’sdefault_storageto let you play with whatever
storage backend you’ll needuploaded image files named using uuidrendition cached on diskresize keeping original aspect ratiocrop if neededsimple widget for admin siteQuick startInstall the app.pipinstalldjango-image-rendererAdd “renderer” to your INSTALLED_APPS setting like this:settings.pyINSTALLED_APPS=(# your apps'renderer',)Include the renderer URL configuration in your projecturls.pylike
this:urls.pyurl(r'^renderer/',include('renderer.urls',namespace='renderer')),Runpython manage.py migrateto create the renderer models.Start the development server and visithttp://localhost:8000/admin/to
create a MasterImage (you’ll need the Admin app enabled).RequirementsPython (2.7, 3.4, 3.5)Django (1.7, 1.8, 1.9)UsageThere is only one model in the app:MasterImage. With aMasterImageyou can ask for renditions.m=MasterImage.objects.first()# get the master file's URLm.get_master_url()# orm.get_rendition_url(0,0)# cache and return URL of a renditions that as 200 pixels width# and height computed according to master's aspect ratiourl=m.get_rendition_url(200,0)# cache and return URL of a renditions that as 50 pixels height# and width computed according to master's aspect ratiourl=m.get_rendition_url(0,50)If you ask for a size that do not fit master’s aspect ration you’ll
receive a center cropped image.You can also ask for a rendition in templates.models.pydefindex(request):m=MasterImage.objects.first()returnrender(request,'demo/index.html',{'master':m,})index.html{%loadrenderer%}...{%renditionmaster4242%}...{%rendition_url4242%}...This will render as:<imgsrc="/media/img/0fb34de8-9d83-456a-828b-72ab21f8ebab_42x42.png"width="42"height="42"alt="">...
/media/img/0fb34de8-9d83-456a-828b-72ab21f8ebab_42x42.png
...When usingMasterImagein your model you may need a widget who
provides a preview for you image. For convenience a mixin is provided.models.pyfromdjango.dbimportmodelsclassDemoModel(models.Model):master=models.ForeignKey('renderer.MasterImage')admin.pyfromdemo.modelsimportDemoModelfromdjango.contribimportadminfromrenderer.widgetsimportMasterImageAdminMixin@admin.register(DemoModel)classDemoModelAdmin(MasterImageAdminMixin,admin.ModelAdmin):fields=('master',)Sample projectA sample project is available in thesamplefolder. Test it as an usual Django project:virtualenv--no-site-packagesvenvsourcevenv/bin/activatepipinstall-rrequirements.txtpythonsample/manage.pymigratepythonsample/manage.pycreatesuperuserpythonsample/manage.pyrunserverIt’ also deployed athttp://django-image-renderer.herokuapp.com/.
Package: django-images-placeholder
Django Images Placeholder=========================Automatic generates images with the right dimensions whenit's missing from the local media storage using metadata ofa common database to generate a image or fetching from analternative MEDIA_URL.Installation------------1. Install the package with:`pip install django-images-placeholder`2. Uninstall the package with:`pip uninstall django-images-placeholder`3. Add "django_images_placeholder" to your INSTALLED_APPS setting like this::```INSTALLED_APPS = [...'django_images_placeholder',]```4. Add and URL to your URLCONF:```...# This is NOT meant to be used in production environment.if settings.DEBUG:from django_images_placeholder.views import serve_image_placeholderurlpatterns = [url(r'^media/', serve_image_placeholder, name='images_placeholder'),] + urlpatterns```5. On `settings.py`, set `MEDIA_URL` to point to it```...STATIC_URL = '/static/'MEDIA_URL = '/media/'MEDIA_ROOT = os.path.join(DATA_DIR, 'media')STATIC_ROOT = os.path.join(DATA_DIR, 'static')DEFAULT_FILE_STORAGE = 'django_images_placeholder.custom_storage.OverwritingStorage'STATICFILES_LOCATION = STATIC_URLMEDIAFILES_LOCATION = MEDIA_URL```6. Optionally, set `ALTERNATIVE_MEDIA_URL` to point to a production MEDIA_URL,so with the view fail to provide an image by openning it locally or tryingto generating it by original image reference' metadata, it you ultimatellytry to fetch `ALTERNATIVE_MEDIA_URL` and cache it:`ALTERNATIVE_MEDIA_URL = 'https://mybucket.s3.amazonaws.com/media/'`
Package: django-image-tools
Django Image Tools is a small app that will allow you to manage your project’s images without worrying much about image sizes, how to crop them, etc..
All you have to do is to define your website sizes and filters and the app will do the rest for you.Check out theofficial docs on readthedocs!Django Image Tools uses Travis CI to test the integration with several versions of Python and Django.
You can see the list of currently supported combinations on ourTravis CI page.
Package: django-image-tools-2
Django Image Tools is a small app that will allow you to manage your project’s images without worrying much about image sizes, how to crop them, etc..
All you have to do is to define your website sizes and filters and the app will do the rest for you.Check out theofficial docs on readthedocs!Django Image Tools uses Travis CI to test the integration with several versions of Python and Django.
You can see the list of currently supported combinations on ourTravis CI page.
Package: django-image-uploader-widget
django-image-uploader-widgetIntroductionA beautiful image uploader widget fordjangoanddjango-admin.Basic PreviewWidget BehaviourTheme Toggle With Django 4.2+Django-Admin Inline Widget for Multiple Files HandlingDocumentationTo understand this package and how to use it you can access the packagedocumentation.InstallingInstall via pip package manager:pipinstalldjango-image-uploader-widgetAdd to installed apps, insettings.py:INSTALLED_APPS=[# ...'image_uploader_widget',# ...]UsageWith Admin# admin.pyfromdjango.contribimportadminfromdjango.dbimportmodelsfromimage_uploader_widget.widgetsimportImageUploaderWidgetfrom.modelsimportYourModel@admin.register(YourModel)classYourModelAdmin(admin.ModelAdmin):formfield_overrides={models.ImageField:{'widget':ImageUploaderWidget},}With ModelForm# forms.pyfromdjangoimportformsfromimage_uploader_widget.widgetsimportImageUploaderWidgetclassExampleForm(forms.ModelForm):classMeta:widgets={'image':ImageUploaderWidget(),}fields='__all__'
Package: django-imapauth
===============django-imapauth===============django-imapauth is a simple IMAP authentification backend for django.Quick start-----------Requirements :* Django 1.4.3 (tested).1. Install the apppypi version```pip install django-imapauth```development version```pip install -e git+http://github.com/ouhouhsami/django-imapauth.git#egg=django-imapauth```2. Add ```'imapauth.backends.IMAPBackend'``` to your ```AUTHENTICATION_BACKENDS``` setting```AUTHENTICATION_BACKENDS = ('imapauth.backends.IMAPBackend','django.contrib.auth.backends.ModelBackend',)```3. Add ```IMAPAUTH_HOST``` in your settings```IMAPAUTH_HOST = 'my_imap_host'```Usage-----With django-imapauth, when a user try to authenticate in your system, the ```IMAPBackend``` will try to connect to the ```IMAPAUTH_HOST``` with his credentials.Be careful, it's not because a user is authenticated that he can access the admin site. For that, refer to the example below, and use ```CustomIMAPBackend``` in ```AUTHENTICATION_BACKENDS```:from imapauth.backends import IMAPBackendclass CustomIMAPBackend(IMAPBackend):def authenticate(self, username=None, password=None):user = super(CustomIMAPBackend, self).authenticate(username, password)if user is None:return Noneuser.is_staff = Trueuser.save()return userFurther information-------------------IMAPBackend copied from http://www.djangorocks.com/tutorials/creating-a-custom-authentication-backend/creating-the-imap-authentication-backend.html
Package: django-imap-backend
Django IMAP backendIMAP back-end fordjango.core.mailpackage, aimed for uploading messages to specif mailboxes, instead of sending it
over SMTP (or other Django email backend). Useful for debugging without fancy services likemailtrap.io. Library is capable of uploading messages to multiple accounts at once (one email
to multiple mailboxes or accounts).MotivationIn last few months I worked on project where we have to send a lot of emails to different mailboxes. We used fake
(and after migration real) e-mail addresses in our staging environment. It was hard to debug these messages without
services likemailtrap(for which we just didn't want to pay, even it's a pretty cool product,
client's budget is client's budged).We came up with the idea of uploading ready-to-send emails to IMAP user instead of sending it.Installation# Using pippipinstalldjango-imap-backend# Using poetrypeotryadddjango-imap-backend# Using setup.pypythonsetup.pyinstallConfigurationFirstly, have to specifydjango_imap_backend.ImapBackendas yourEMAIL_BACKENDinsettings.py. Than you need to
add configuration for your mailboxes inEMAIL_IMAP_SECRETSlist. Your'ssetings.pyshould looks like this:EMAIL_BACKEND='django_imap_backend.ImapBackend'EMAIL_IMAP_SECRETS=[{'HOST':'imap.example.com','PORT':None,# default 143 and for SSL 993'USER':'artuhur.dent','PASSWORD':'TheQuestion42','MAILBOX':'my_project',# Created if not exists'SSL':False# Default}]Made with ❤️ and ☕️ by Jakub Dubec &BACKBONE s.r.o.Changelog0.2.3 : 2020-07-19Fix: Version files update 🤦‍♀️ Once again...0.2.2 : 2020-07-19Fix: Version files update 🤦‍♀️0.2.1 : 2020-07-19Fix: Fallback to defaultMailboxif configuration is not present0.2.0 : 2020-07-10Change:EMAIL_IMAP_MAILBOXESrenamed toEMAIL_IMAP_SECRETSbecause of security (we don't want to show IMAP
configuration in Django debug mode)Change:sensitive_variablesdecoration in IMAP client0.1.1 : 2020-07-05Fix PyPi release (shit happens).0.1.0 : 2020-07-05Initial version SSL and support for multiple IMAP accounts.
Package: django-imger
Imger is a client side resizing and placement tool for images.
Images are stored in the settings.MEDIA_ROOT so settings.py needs to include:
MEDIA_ROOT and MEDIA_URLQuick startAdd MEDIA_ROOT and MEDIA_URL to settings.py. something like:MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')Make sure imger static files are in your static directory:/static/imgerAdd “imger” to your INSTALLED_APPS setting like this:INSTALLED_APPS = (
    ...
    'imger',
)Import ImgerField into your model and create an ImgerField a model class:from imger.fields import ImgerField

    ...
    image_path = ImgerField(upload_to='testing', width=400, height=300, mime='image/jpg', quality=80)

    All parameters are optional and default as follows:

    upload_to: settings.MEDIA_ROOT
    width: 300
    height: 200
    mime: image/jpg
    quality: 100Start the development server and visithttp://127.0.0.1:8000/admin/Navigate to your model with the imger field and upolad an image
(you’ll need the Admin app enabled).
Package: django-imgwidget
django-imgwidgetdjango-imgwidgetis a Django package that provides easy and efficient image uploading in the admin site. It supports single-image uploads as well as batch uploads for multiple images. The package comes with features like large image preview, image deletion, and image rotation preview.FeaturesSave as json or string to a fieldSingle-image and batch upload support.Large image preview with the ability to delete images.Image rotation preview for a better viewing experience.Keyboard shortcuts for enhanced user experience.InstallationInstall the package using pip:pipinstalldjango-imgwidget


-----
👍后台上传图片

⚡️单图片、多图片批量上传

✨图片大图预览、删除

🐰图片旋转预览

🔥支持键盘快捷操作1.支持左右键切换预览图片2.支持ESC退出预览模式🌈 效果图片!Installationpip install django-imgwidgetHomepage: https://pypi.org/project/django-imgwidgetStepsAdddjango_imguploderto your settings.pyConfigure the image upload route, route name isupload_imagepath("upload",ImageUploadView.as_view(),name='upload_image')Write a view function.
Need to return JsonResponseimage_list error_msg, if there are errors, return error_msg error prompt. example:classImageUploadView(views.View):defpost(self,request):files=request.FILESor{}image_list=[upload_img(file)forfileinlist(files.values())]returnJsonResponse({"error_msg":"","image_list":image_list,})Use the MultiImageField in admin.py# models.pyclassMyModel(models.Model):imgs=models.TextField(default=[],null=False,verbose_name='图片')description=models.CharField(verbose_name="描述",null="",max_length=100)# admin.pyclassUploadImgsForm(ModelForm):imgs=MultiImageField(label="imgs",max_count=13,required=False)description_img=MultiImageField(label="description",max_count=1,required=False,save_json_list=False)classCameraAdmin(admin.ModelAdmin):fieldsets=[('information',{'fields':(('imgs',),('description_img',),)}),]form=UploadImgsForm# result: imgs -> '["1.jpeg", "2.jpg"]', description -> description_img.jpegConfiguration：accept:

config<input>accept

max_count:

Description: Defines the maximum number of files that can be selected/uploaded using the file input.

save_json_list:
Description: Determines whether the uploaded file names are saved as a JSON-formatted list or string.
Package: django-impala-backend
django-impala-backenduse impala as django database backendFree software: MIT licenseDocumentation:https://django-impala-backend.readthedocs.io.FeaturesTODOCreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.1.0 (2020-05-21)First release on PyPI.
Package: django-imperavi
InstallationInstall or adddjango-imperavito your python path.Addimperavito yourINSTALLED_APPSsetting.Add imperavi URL include to your project’surls.pyfile:url(r'^imperavi/', include('imperavi.urls')),UsageThe quickest way to add rich text editing capabilities to your admin is to use the includedImperaviAdminclass. For example:from models import Category
from imperavi.admin import ImperaviAdmin

class CategotyAdmin(ImperaviAdmin):
    pass

admin.site.register(Category, CategotyAdmin)If you want to use it with inline admin models you need to useImperaviStackedInlineAdminclass:from models import Post
from imperavi.admin import ImperaviStackedInlineAdmin

class PostInline(ImperaviStackedInlineAdmin):
    model = Post
    extra = 1Custom settingsAdd aIMPERAVI_CUSTOM_SETTINGSvariable to yoursettings.pywith custom config:IMPERAVI_CUSTOM_SETTINGS = {
    'lang': 'ua',
    'toolbar': 'mini',
    'resize': true
}Full list of settings ishere.Media URLYou can also customize the URL that django-imperavi will look for the Editor media at by addingIMPERAVI_UPLOAD_PATHto yoursettings.pyfile like this:IMPERAVI_UPLOAD_PATH = 'imperavi-uploads/'The default value is'imperavi/'.Unique images per modelIf you want to serve unique media content for specific model you can addunique_media = Trueto your admin class:from models import Category
from imperavi.admin import ImperaviAdmin

class CategotyAdmin(ImperaviAdmin):
    unique_media = True

admin.site.register(Category, CategotyAdmin)
Package: django-imperavi-redactor
This package is based on thehttps://bitbucket.org/gearheart/django-redactorpackage for the old version of imperavi editor.Warning!!!The editor is not part of the package, as it is proprietary.Installation`
pip3 install django-imperavi-redactor==0.0.4a
`Put the editor files:static/redactor/redactor.min.jsstatic/redactor/redactor.min.css