Skip to content

Commit

Permalink
add the COS_FAST_CDN
Browse files Browse the repository at this point in the history
  • Loading branch information
Ford Guo committed Aug 27, 2019
1 parent 2e96018 commit 8700945
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ git+https://github.com/fordguo/django-storage-qcloud.git
```
- 其他配置:
COS_URL = 'https://www.qixincha.com' # 自定义域名, 不配置将使用 COS 默认域名
COS_FAST_CDN = False # 默认加速域名是否开启

* 同步静态文件到云
`python manage.py collectstatic`
Expand Down
5 changes: 4 additions & 1 deletion django_storage/qcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@ def url(self, name):

if getattr(settings, 'COS_URL', ''):
url = "{}/{}".format(settings.COS_URL, name)
elif getattr(settings, 'COS_USE_CDN', False):
url = "https://{}.file.myqcloud.com/{}".format(
self.bucket, name)
else:
url = "http://{}.cos.{}.myqcloud.com/{}".format(
url = "https://{}.cos.{}.myqcloud.com/{}".format(
self.bucket, self.option['Region'], name
)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
AUTHOR = "Ford"
AUTHOR_EMAIL = "agile.guo@gmail.com"
URL = "https://github.com/fordguo/django-storage-qcloud"
VERSION = '0.1.2'
VERSION = '0.1.3'

setup(
name=NAME,
Expand Down

0 comments on commit 8700945

Please sign in to comment.