安装django-aliyun-oss2-storage-0.1.5.tar.gz
settings文件添加
MEDIA_ROOT = os.path.join(BASE_DIR,'upload/')
MEDIA_URL = '/upload/' DEFAULT_FILE_STORAGE = 'aliyun_oss2_storage.backends.AliyunMediaStorage'
ACCESS_KEY_ID = "LTAI3D3Gcp5ugd4R"
ACCESS_KEY_SECRET = "LX1MwopRVMyKRlwm88ecTilZ50qipx"
END_POINT = "oss-cn-beijing.aliyuncs.com"
BUCKET_NAME = "zlcc"
BUCKET_ACL_TYPE = "public-read" # private, public-read, public-read-write
# STATICFILES_STORAGE = 'aliyun_oss2_storage.backends.AliyunStaticStorage' #不注释的时候admin后台样式路径错误