Skip to content Skip to sidebar Skip to footer

Django-configurations Is Causing My Static_url To Be Invalid

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 d

Solution 1:

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'),)

Solution 2:

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.

v-0.8 vs updated 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

Post a Comment for "Django-configurations Is Causing My Static_url To Be Invalid"