Skip to main content

store Django Static Files on Amazon S3

Project description

Installation

$ [sudo] pip install django-s3-static

settings.py

INSTALLED_APPS = [
    "django_s3_static",
]

AWS_STATIC_BUCKET_NAME = "<name>"
AWS_STATIC_DOMAIN = '%s.s3.amazonaws.com' % AWS_STATIC_BUCKET_NAME
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = "https://%s/" % AWS_STATIC_DOMAIN

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" %}">

django-readme-generator

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-s3-static-2019.4.13.tar.gz (1.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page