Skip to main content

Django OSS Image Upload Widget with Customizable Configuration

Project description

Django Image Uploader Widget

安装

pip install dj-image-uploader-widget

配置

# settings.py
DJ_IMAGE_UPLOADER_OSS_CONFIG = {
    'ACCESS_KEY_ID': 'your_aliyun_key',
    'ACCESS_KEY_SECRET': 'your_aliyun_secret',
    'ENDPOINT': 'oss-cn-beijing.aliyuncs.com',
    'BUCKET_NAME': 'your-bucket-name',
    'BASE_PATH': 'user-uploads/'  # 可选
}

INSTALLED_APPS = [
    ...
    'dj_image_uploader_widget',
]

# urls.py
from dj_image_uploader_widget import views as upload_views

urlpatterns = [
    ...
    path('upload/', upload_views.upload_view, name='image_upload'),
]

使用示例

# models.py
from django.db import models
from dj_image_uploader_widget.fields import ImageUploadField

class Article(models.Model):
    cover = ImageUploadField(
        upload_url='/upload/',  # 对应你的上传路径
        verbose_name="文章封面"
    )

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dj_image_uploader_widget-0.4.1.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dj_image_uploader_widget-0.4.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file dj_image_uploader_widget-0.4.1.tar.gz.

File metadata

File hashes

Hashes for dj_image_uploader_widget-0.4.1.tar.gz
Algorithm Hash digest
SHA256 9247f361009c037e2b37e20c57056ddfe9d288aaae9868251f8da64535b4a6c8
MD5 6dc9c001388da6d21464f44bdb367f48
BLAKE2b-256 c0f2fd6747a91c7d090afaaad8c6a230c2e6d86952db277cd074107321279783

See more details on using hashes here.

File details

Details for the file dj_image_uploader_widget-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for dj_image_uploader_widget-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d8a76d077f6bccbf53975630638c1959a6c3f0bfb15e90c7709dd218ebca57a1
MD5 04b8c4f49beddb1f85a6e0e8034969dd
BLAKE2b-256 57249586ad30ccb59f85399e105f72229e86db743b4d23effb8fdb20de28fd48

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page