Django-Configurations导致我的STATIC_URL无效 [英] Django-Configurations is causing my STATIC_URL to be invalid
问题描述
from配置导入配置,值
BUCKET_NAME = values.SecretValue()
STATIC_URL ='https://s3.amazonaws.com/%s/'%BUCKET_NAME
但是STATIC_URL设置为:
https://s3.amazonaws.com/<Value默认值:无>'
哪个不是有效或意图我也有正确的环境变量:DJANGO_BUCKET_NAME ='thekey'
任何帮助将不胜感激
我查看了django cookie cutter的问题,发现这个解决方案:
https://github.com/burhan/cookiecutter-django/commit/c8ee217dd72ec29ccea4f683d83ca7438247461c
其中告诉我要切换:
STATIC_URL ='https://s3.amazonaws.com/%s/' %AWS_STORAGE_BUCKET_NAME
至:
STATIC_URL ='https://s3.amazonaws.com/%s/'%(AWS_STORAGE_BUCKET_NAME.setup('DJANGO_AWS_STORAGE_BUCKET_NAME'),)
I have a django(1.6.5) project and I am using the django-configurations(0.8) package and I am trying to set the STATIC_URL in the settings.py file with an environment variable by doing:
from configurations import Configuration, values
BUCKET_NAME = values.SecretValue()
STATIC_URL = 'https://s3.amazonaws.com/%s/' % BUCKET_NAME
But the STATIC_URL is set to:
'https://s3.amazonaws.com/<Value default:None>'
which is not valid or intended. I have the correct environment variable set too: DJANGO_BUCKET_NAME='thekey'
Any help would be appreciated
I looked at issues with the django cookie cutter and found this solution:
https://github.com/burhan/cookiecutter-django/commit/c8ee217dd72ec29ccea4f683d83ca7438247461c
Which told me to switch:
STATIC_URL = 'https://s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME
to:
STATIC_URL = 'https://s3.amazonaws.com/%s/' % (AWS_STORAGE_BUCKET_NAME.setup('DJANGO_AWS_STORAGE_BUCKET_NAME'),)
这篇关于Django-Configurations导致我的STATIC_URL无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!