Reputation: 503
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
Upvotes: 1
Views: 203
Reputation: 191
The problem is the __repr__
method for Value
in django-configurations.
They already fixed this issue but didn't update the pckage version, so pypy still reference the buggy version.
A workaround is to set your STATIC_URL
to:
'https://s3.amazonaws.com/%s/' % (AWS_STORAGE_BUCKET_NAME.setup('AWS_STORAGE_BUCKET_NAME'),)
Source: https://github.com/burhan/cookiecutter-django/commit/c8ee217dd72ec29ccea4f683d83ca7438247461c
Upvotes: 2
Reputation: 503
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'),)
Upvotes: 3