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-to-oss/', upload_views.upload_view, name='image_upload'),
]

使用示例

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

class Article(models.Model):
    cover = ImageUploaderField(
        upload_url='/upload-to-oss/',  # 对应你的上传路径
        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.8.tar.gz (7.4 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.8-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for dj_image_uploader_widget-0.4.8.tar.gz
Algorithm Hash digest
SHA256 d7eea67cb2e51a86742da4e9d597a19913c7a1d1bee123e7bdff2a00c6ee81b3
MD5 23409867d6fad7373fb6dd630cea5114
BLAKE2b-256 7a1387fc7e80892c0f17ca5244a2d1a87c96c383cd76da85907bb9906760c130

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dj_image_uploader_widget-0.4.8-py3-none-any.whl
Algorithm Hash digest
SHA256 7eea732628173354db98edf203616887760e5e3aba6caed5a87775a5d8c3b5ec
MD5 947102493e786ae45e0a5e7e5f529e77
BLAKE2b-256 a57020b28ef567009f5c355543ca1dc8a3419d29c4034673ef8dacc7b80ed2c6

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