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
Commands
command | help |
---|---|
python manage.py s3_static_create |
create s3 bucket and policy |
python manage.py s3_static_sync |
sync static directory with s3 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-2019.7.24.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 443154cc18c62bfb5a8bc125fe7cd14cd4ebb954e8c4cead9d2acddd56faff99 |
|
MD5 | 52bab366c2d72bc34ead9c4e96466779 |
|
BLAKE2b-256 | 575c6f952b1b890055c51e24d7b3451c533527fcf146bc37f089a4cf3f70bc05 |