store Django Static Files on Amazon S3
Project description
Installation
$ [sudo] pip install django-s3-static
settings.py
INSTALLED_APPS = [
"django_s3_static",
]
settings/dev.py
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/static/'
settings/prod.py
AWS_STATIC_ACCESS_KEY_ID = os.getenv('AWS_STATIC_ACCESS_KEY_ID')
AWS_STATIC_SECRET_ACCESS_KEY = os.getenv('AWS_STATIC_SECRET_ACCESS_KEY')
AWS_STATIC_BUCKET = os.getenv('AWS_STATIC_BUCKET')
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = "https://%s.s3.amazonaws.com/" % AWS_STATIC_BUCKET
Examples
$ python manage.py s3_static_create # create s3 bucket and policy
$ python manage.py s3_static_sync # sync static folder with s3 bucket
{% load static %}
<link rel="stylesheet" href="{% static "css/file.css" %}">
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for django-s3-static-2020.7.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01645253fe1b8fe0b9f8ffbefc48b0e18d46d03c52b8976625e875407b8da6bc |
|
MD5 | 6e040bf0941bff9892ee983a40d33463 |
|
BLAKE2b-256 | 000d4ee568b155035f51ac2f78552448a96ad4f1061d1bc6ee4665f2daf563fd |