Search code examples
pythondjangodigital-oceanbucket

Django static tag adding queryparams to generated static files when using DigitalOcean spaces


So, my webpage generates file that includes the access tokens when using the static tag in django to link to my static files, preferably i would like this link to go to my server, aka:

http://xxx.xxx.xxx/static/css/main.css

Right now its generating:

https://******.digitaloceanspaces.com/fpl/static/css/main.css?AWSAccessKeyId=&Signature=%3D&Expires=1571503012

in my html

My settings for static files in production:

AWS_ACCESS_KEY_ID = '***' 
AWS_SECRET_ACCESS_KEY = '****' 
AWS_STORAGE_BUCKET_NAME= '***' 
AWS_S3_ENDPOINT_URL = 'https://*****.digitaloceanspaces.com' AWS_S3_OBJECT_PARAMETERS = {
    'CacheControl': 'max-age=86400', } AWS_LOCATION = 'static'

STATIC_URL = 'http://***.***.***' 
STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'

How can i change the settings to make it link to my servers nginx instead?


Solution

  • I found it, you can disable the generation of queryparams by using the

        AWS_QUERYSTRING_AUTH = False
    

    param in your settings.py