Git Product home page Git Product logo

whitenoise's Introduction

WhiteNoise

image

image

image

image

pre-commit

Radically simplified static file serving for Python web apps

With a couple of lines of config WhiteNoise allows your web app to serve its own static files, making it a self-contained unit that can be deployed anywhere without relying on nginx, Amazon S3 or any other external service. (Especially useful on Heroku, OpenShift and other PaaS providers.)

It's designed to work nicely with a CDN for high-traffic sites so you don't have to sacrifice performance to benefit from simplicity.

WhiteNoise works with any WSGI-compatible app but has some special auto-configuration features for Django.

WhiteNoise takes care of best-practices for you, for instance:

  • Serving compressed content (gzip and Brotli formats, handling Accept-Encoding and Vary headers correctly)
  • Setting far-future cache headers on content which won't change

Worried that serving static files with Python is horribly inefficient? Still think you should be using Amazon S3? Have a look at the Infrequently Asked Questions.

To get started, see the documentation.

whitenoise's People

Contributors

acdha avatar adamchainz avatar akx avatar bz2 avatar cuducos avatar dependabot[bot] avatar edmorley avatar evansd avatar hanswilw avatar jamesbeith avatar jnns avatar jribbens avatar keimlink avatar lukeburden avatar mathieusteele avatar mdalp avatar mdboom avatar mjhea0 avatar mkai avatar ndevox avatar openjck avatar pamelafox avatar pauloxnet avatar peterjclaw avatar pre-commit-ci[bot] avatar rsalmaso avatar rtibbles avatar ryanrhee avatar thedrow avatar timgraham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

whitenoise's Issues

Error on checking for file modification

I was modifying javascript source code during running wsgi application with whitenoise.
Sometimes I got Internal Server Error from static file serving.

ubuntu 14.04 64bit
python 3.4.1
whitenoise 1.0.2

Traceback (most recent call last):
  File "/home/aodag/works/my.cms/.venv/lib/python3.4/site-packages/whitenoise/base.py", line 63, in __call__
    return self.serve(static_file, environ, start_response)
  File "/home/aodag/works/my.cms/.venv/lib/python3.4/site-packages/whitenoise/base.py", line 70, in serve
    if self.file_not_modified(static_file, environ):
  File "/home/aodag/works/my.cms/.venv/lib/python3.4/site-packages/whitenoise/base.py", line 95, in file_not_modified
    return parsedate(last_requested) >= static_file.mtime
TypeError: unorderable types: tuple() >= int()

Add ability to set a custom Content Type for specific files without an extension

Apple's apple-app-site-association file must be served with the application/pkc7-mime content type (see: https://developer.apple.com/library/ios/documentation/Security/Reference/SharedWebCredentialsRef/), but Whitenoise is serving it with application/octet-stream, because the file has no extension and as such mimetypes determines it should provide the default octet-stream.

Would it be feasible to have some sort of file -> content type mapping which we could use whenever you would like to override the mimetypes library.

ValueError files not found

I get a 500 (404?) error when trying to use whitenoise locally.

ValueError: The file 'css/bootstrap.css' could not be found with <whitenoise.django.GzipManifestStaticFilesStorage object at 0x10b13c050>.

Whenever DEBUG is True, everything works fine. When it's False, everything blows up. My static settings:

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'static',),
)
STATIC_URL = '/static/'
STATIC_ROOT = 'staticfiles'
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

2.0 broke STATIC_URL handling in Django for absolute URLs

Firstly, thanks for Whitenoise, I've really appreciated it.

I've bumped into a small problem with Whitenoise 2.0. I have the following as my STATIC_URL:

STATIC_URL = 'https://static.example.com/'

This makes whitenoise fail to load correctly, since get_prefix_url returns '/', and so you get the odd error (from here):

Both STATIC_URL and STATIC_ROOT settings must be configured to use DjangoWhiteNoise

Reverting to whitenoise==1.0.6 works. I think the breaking change is 25f5757.

I'm not quite sure what the breaking change was intending to do, so I'm not quite sure what an appropriate patch would be. I think it's something to do with local development based on the release notes of 2.0.

Extend EXTRA_MIMETYPES from Django settings?

It looks like the only way to extend EXTRA_MIMETYPES is by subclassing the WhiteNoise class. For Django projects, it might be nice to add mimetypes from WHITENOISE_EXTRA_MIMETYPES in django.conf.settings as well.

(FWIW, the mime type I'm missing is ('image/svg+xml', '.svg'). Not sure how common that problem is.)

Gzip compression not being enabled

I'm a newbie so forgive me if I made a mistake but I've triple checked everything and I can't seem to figure out why Gzip compression is not being enabled.

here is an example response header for a css file (from chrome dev-tools):

HTTP/1.1 304 Not Modified
Content-Length: 0
Connection: keep-alive
Server: gunicorn/19.3.0
Date: Tue, 18 Aug 2015 14:11:07 GMT
Via: 1.1 vegur

package versions:
Django==1.8.3
gunicorn==19.3.0
whitenoise==2.0.2

Static files configuration (settings.py)

BASE_DIR = os.path.dirname(os.path.dirname(__file__))

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, "static"),
)

wsgi.py

import os
from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sikumim.settings")

application = get_wsgi_application()

#HEROKU DEPLOYMENT

from whitenoise.django import DjangoWhiteNoise
application = DjangoWhiteNoise(application)

# Fix django closing connection to MemCachier after every request (#11331)
from django.core.cache.backends.memcached import BaseMemcachedCache
BaseMemcachedCache.close = lambda self, **kwargs: None

an example of how I'm loading static files in template:

{% load staticfiles %}
<link href="{% static "css/base.css" %}" rel="stylesheet" type="text/css">

extra production settings for Gzip:

STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

Procfile:

web: gunicorn sikumim.wsgi

Not working with django-assets

I'm using django-assets to minify/merge my assets. All the files are correctly generated when running collectstatic but the packed files (from django-assets) are never served.

Example code from my webpages:

<script type="text/javascript" src="/static/gen/packed.js?5df0a1aa"></script> <!-- generated using django-assets loop -->
<script type='text/javascript' src='/static/js/contact_me.95b1c452b73b.js'></script> <!-- normal static call -->

Support index files

Eg: if there's an foo/index.html it should be served at foo/. Also, foo should redirect to foo/.

make_helpful_exception() in whitenoise.django.py produces AttributeError: 'ValueError' object has no attribute 'message'

The code in make_helpful_exception() assumes the existence of the "message" attribute of the BaseException class. That attribute was deprecated in Python 2.6 and removed in Python 3. The exception message is now referenced in args.

Here is the applicable line of whitenoise.django.py (line 135):

match = self.ERROR_MSG_RE.search(exception.message)

From your documentation, it doesn't look like Whitenoise intends to support Python versions older than 2.7, so fixing the problem should be as easy as changing the line to this:

match = self.ERROR_MSG_RE.search(exception.args[0])

...and making the same alteration a few lines later:

orig_message=exception.args[0]

Document storage backend requirements for compatibility

It would be helpful to add the requirements of the storage backend that whitenoise uses to the documentation for subclassing. For example, does it require that the storage backend supply a local file path, or could it use a remote storage backend?

Are comments in CSS files respected?

I get an error that my CSS references a file which does not exist. I want to comment it out and deal with it at a later date, but both multiline and single line comments seem to be ignored and I still get the same error message.

For example,

/*url('../images/jumbotron-styled/bgbl.svg') bottom left no-repeat,*/

on its own line returns the error

The CSS file 'css/usr/main.css' references a file which could not be found:
css/images/jumbotron-styled/bgbl.svg

Please check the URL references in this CSS file, particularly any
relative paths which might be pointing to the wrong location.

Drop support for Django < 1.8

Django 1.7 and older are no longer supported. I propose to drop support for older versions to cleanup the code and ease future development.

Suggestions for Flask Application

Currently "WhiteNoise works with any WSGI-compatible app but has some special auto-configuration features for Django". What, if at all, is the suggestion for using whitenoise with a Flask application?

Flask already has a performant send_file that unlike Django's static serving, which works only in development, will work in production as well.

Py3 Bug -> Cannot index dict_keys()

If you pass a parameter like max_age on Python3 then Whitenoise blows up:

Traceback (most recent call last):
  File "/Users/dstufft/.virtualenvs/warehouse/bin/warehouse", line 9, in <module>
    load_entry_point('warehouse==14.2.1', 'console_scripts', 'warehouse')()
  File "/Users/dstufft/projects/warehouse/warehouse/__main__.py", line 23, in main
    return Warehouse.from_cli(sys.argv[1:])
  File "/Users/dstufft/projects/warehouse/warehouse/application.py", line 243, in from_cli
    app = cls.from_yaml(*configs)
  File "/Users/dstufft/projects/warehouse/warehouse/application.py", line 217, in from_yaml
    return cls(config=config, **kwargs)
  File "/Users/dstufft/projects/warehouse/warehouse/application.py", line 172, in __init__
    max_age=31560000,
  File "/Users/dstufft/.virtualenvs/warehouse/lib/python3.3/site-packages/whitenoise/base.py", line 30, in __init__
    kwargs.keys()[0]))

Support redirecting to HTTPS / setting HSTS header

Typically redirecting HTTP requests to HTTPS or setting an HSTS header would be the responsibility of ngnix/Apache, however when using Heroku these aren't an option.

One might say that the wgsi app that WhiteNoise wraps should handle this instead (example) -- since it could make the redirect when serving the homepage.

However:
(a) this doesn't protect direct requests to static assets served by WhiteNoise (even if HSTS was enabled, the first visit to the site might be to a WhiteNoise served file instead)
(b) this doesn't help sites whose homepage is not dynamic, and is served by WhiteNoise itself (which is the case I hit, since the site UI is entirely Angular.js, with Django powering just the site API).

It's worth noting that when determining whether to redirect on Heroku, the HTTP_X_FORWARDED_PROTO header must be observed, since both HTTP and HTTPS requests arrive on the same port on the Heroku web dyno. (And similarly for Azure, one must check x-arr-ssl.)

I see three options:

  1. Add support for redirects + HSTS in WhiteNoise.
  2. Add an option for only serving requests over HTTPS via WhiteNoise, and let anything else fall through to the wrapped wgsi app so it can respond with the redirect/HSTS header itself.
  3. Wontfix for WhiteNoise, but add recommendations to the docs for using some other wgsi wrapper that itself wraps WhiteNoise (though I'm struggling to find something generic).

@evansd, what are your thoughts? :-)

OPTIONS HTTP request support

Currently whitenoise only allows GET and HEAD HTTP requests. If you put a CDN in front of whitenoise and attempt to GET an asset across domains, the browser send a preflight ORIGINS HTTP request first, to see if it can then GET the asset. Therefore it would be nice to have the ORIGINS HTTP request permitted as well.

Should Whitenoise set CORS headers by default for all files?

Currently, Whitenoise sets an Access-Control-Allow-Origin: * header by default for all font files. This was done so that your fonts continue to work in Firefox if you're using a CDN.

I've since discovered other cases where CORS headers are needed, for instance the respond.js media query polyfill for IE which loads stylesheets over XHR.

I'm tempted to set Access-Control-Allow-Origin: * header by default for all files. My reasoning is that:

  1. it will mean that putting a CDN in front of Whitenoise just works, without any nasty cross-origin surprises;
  2. given that Whitenoise only serves public, static files there are no security implications to allowing cross-origin requests.

I'm aware though that automatically setting these headers is a slightly surprising thing for an application to do and I'd really welcome feedback on whether people think it's a good idea.

DjangoWhiteNoise doesn't handle multiple slashes in URL the same way as Django

When running with the Django development server, accidental multiple slashes in a URL like static//global.css will be converted into static/global.css, and so the asset will be served succesfully.

The same URL when served through DjangoWhiteNoise will however not find the asset.

This leads to a frustrating situation where the site looks like it works to developers running the site locally but then has errors when pushed to the deployed environment.

Can I suggest that DjangoWhiteNoise should treat these URLs the same way Django does?

{% static %} doesn't include hash

Can't get the darn thing to work with
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

But with my own homebrewed combination of django-pipeline and whitenoise:

from pipeline.storage import PipelineMixin
from whitenoise.django import GzipManifestStaticFilesStorage

class GzipManifestPipelineStorage(PipelineMixin, GzipManifestStaticFilesStorage):
    pass

and then
STATICFILES_STORAGE = 'app.storages.GzipManifestPipelineStorage'
at least the {% compressed_css %} tag of django-pipeline outputs the hash. but {%static%} still doesn't

So tl;dr: Following documentation the {%static%} tag outputs style.css instead of style.hash.css

Collectstatic on heroku with assets not in repo?

How can I use Whitenoise on Heroku with static assets I don't include in my git repo?

I install lots of js tools via bower, and try to keep my repo clean by excluding my bower installs (but leaving the bower.json). This means that those static files are not in the files Heroku sees on push, so collectstatic() can't include them in the manifest. When I was using django pipeline, I got around this by running collectstatic() with production settings from my local repo (that had the bower installs) and writing to s3.

What is the best way to proceed? I guess I could git submodule all of the tools I use, but this would quickly slow down my deploys and make my slug bigger than I desire. Alternatively, I could include my build artifacts (but not the bower sources) in my repo, but that seems unclean.

Documentation creates clone of application on CloudFront

Hi! Using your documentation, I set CloudFront to point to my application and then served static assets using CloudFront. This works great, however if you go to a URL from the application using the CloudFront domain, it shows a static clone of that view. This creates issues with web crawlers and users mistaking the CloudFront instance for the application.

Compression not working

Hey guys. I hope you can help.

I have a setup running Django Pipeline with Django Whitenoise and everything seems to be working, but it doesn't. The gz files are generated perfectly, but it seems like whitenoise isn't serving the correct headers and thus, the browser doesn't fetch the gz files.

My setup is as follows

STATICFILES_STORAGE = 'sonofatailor.cached_storage.GzipManifestPipelineStorage'

where the storage class is defined as follows

from pipeline.storage import PipelineMixin
from whitenoise.django import GzipManifestStaticFilesStorage

class GzipManifestPipelineStorage(PipelineMixin, GzipManifestStaticFilesStorage):
    pass

This part seems to work great as stated above, and all the correct gz files are stored along side the other files

My wsgi.py looks lige this

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.prod")

from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise

application = get_wsgi_application()
application = DjangoWhiteNoise(application)

And i run my application through apache with

["python", "sonofatailorapp/manage_prod.py", "runmodwsgi", "config.wsgi", "--port=80", "--log-to-terminal", "--startup-log"]

where manage_prod.py looks like

import os
import sys

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.prod")

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)

Can anybody spot, what i'm doing wrong ?

The page is here http://107.178.250.104/

and you can test that the gz file is there and available here

http://107.178.250.104/static/scripts_dist/common.min.b947a82fca17.js
http://107.178.250.104/static/scripts_dist/common.min.b947a82fca17.js.gz

Serving Media Files

Hi all,

I am wondering how to handle my media files (MEDIA_URL, MEDIA_ROOT), because currently they do not seem to be served.

So first of all, is it recommended that I serve my media files via whitenoise anyway? And if so, what is the best way to do so? I was thinking about add_files().

And if things work, I'd be happy to update the docs.

Thanks for your help
Juergen

Serving media files

Is there any option in DjangoWhiteNoise to serve media files like MediaCling of dj-static?

"No Module named Storage"

STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

Gives a "No module named Storage error". The Django one does not.

In addition, if I use add this to MIDDLEWARE_CLASSES, 'whitenoise.middleware.WhiteNoiseMiddleware' I get a "no module named middleware" error

Minor nitpick: When using on Python 3 the chained Exception output is confusing

Because Whitenoise does this in it's __call__ method:

try:
    static_file = self.files[environ['PATH_INFO']]
except KeyError:
    return self.application(environ, start_response)
else:
    return self.serve(static_file, environ, start_response)

If the application itself raises an exception the chained exception looks like this:

Traceback (most recent call last):
  File "/Users/dstufft/.virtualenvs/warehouse/lib/python3.4/site-packages/whitenoise/base.py", line 48, in __call__
    static_file = self.files[environ['PATH_INFO']]
KeyError: '/account/login/'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/dstufft/projects/warehouse/warehouse/accounts/db.py", line 70, in user_authenticate
    password_hash,
  File "/Users/dstufft/.virtualenvs/warehouse/lib/python3.4/site-packages/passlib/context.py", line 2613, in verify_and_update
    record = self._get_or_identify_record(hash, scheme, category)
  File "/Users/dstufft/.virtualenvs/warehouse/lib/python3.4/site-packages/passlib/context.py", line 2258, in _get_or_identify_record
    return self._identify_record(hash, category)
  File "/Users/dstufft/.virtualenvs/warehouse/lib/python3.4/site-packages/passlib/context.py", line 1455, in identify_record
    raise ValueError("hash could not be identified")
ValueError: hash could not be identified

Which is confusing when you first look at it why the exception is inside of Whitenoise for something that obviously isn't a static file.

It would be cool for this code to be something more like:

static_file = environ.get('PATH_INFO')
if static_file is None:
    return self.application(environ, start_response)
else:
    return self.serve(static_file, environ, start_response)

Example with Bottle?

I am using bottle on Heroku. Heroku recommends your project for static file serving from a Python app.

Looking at your WSGI example, I am unsure how well it can be integrated. I am using gunicorn as my server.

Not able to use WhiteNoiseMiddleware

I follow the 'QuickStart for Django apps' on the Github repo home page but got the error ImportError: No module named 'whitenoise.middleware'.

$ pip install whitenoise
Requirement already satisfied (use --upgrade to upgrade): whitenoise in /usr/local/lib/python3.5/site-packages

$ ls /usr/local/lib/python3.5/site-packages/whitenoise                             
__init__.py  __pycache__  base.py  django.py  gzip.py  management  storage_backport.py

It appears that middleware.py is not in the PIP install.

Also the "QuickStart for Django apps" on whitenoise.evans.io/en/stable/ is different from the Github repo.

gzip.py module collides namespace with gzip module

gzip.py tries to import the gzip module but ends up importing itself. Apparently "." is added to the sys path by default. "." could be removed from the path but I think prettier way would be to rename gzip.py so that there is no name collision.

/usr/lib/python3.4/site-packages/whitenoise/gzip.py         
Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/whitenoise/gzip.py", line 6, in <module>
    import gzip
  File "/usr/lib/python3.4/site-packages/whitenoise/gzip.py", line 15, in <module>
    GzipFile = gzip.GzipFile
AttributeError: 'module' object has no attribute 'GzipFile'

Are relative paths a problem for GzipManifestFileStorage?

Hi David

Just got this when running collectstatic locally (Django 1.6.5), which I'm assuming is still required behaviour with whitenoise wrapping the core WSGI app:

Post-processing 'yj/css/page_specific/badge.css' failed!
...
ValueError: The file 'yj/css/images/icons/arrow-down-black.svg' could not be found with <whitenoise.django.GzipManifestStaticFilesStorage object at 0x10310ee50>.

That arrow-down-black.svg is referenced in the compiled badge.css file as

background-image:url("../images/icons/arrow-down-black.svg")

Is it the relative path that's breaking things here?

I appreciate this is UserError, not a bug, but a steer would we welcome, as I've not noticed any gotchas in the docs.

Cheers
Steve

DEBUG=False not working due to Suffixes

When using whitenoise in DEBUG=True, templates request files like:
/static/rest_framework/css/bootstrap-tweaks.css
which are properly served up.

With DEBUG=False the template requests:
/static/rest_framework/css/bootstrap-tweaks.964c59eecf05.css and this file is not properly served.

What is causing this suffix to be inserted?

When I am running with DEBUG=False , If I manually navigate to /static/rest_framework/css/bootstrap-tweaks.css, the content is served.

UWSGI and Whitenoise

Hello,

I am running 2 docker containers: 1) nginx proxy and 2) uwsgi with my django 1.8 app.
I have to solve the static files issue since nginx normally handles the static files so I found whitenoise.
I followed the simple howto and changed my wsgi.py:

import os

from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ironman.settings")
#os.environ("DJANGO_SETTINGS_MODULE", "ironman.settings")

application = get_wsgi_application()
application = DjangoWhiteNoise(application)

and my settings.py:

WSGI_APPLICATION = 'ironman.wsgi.application'
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'static'),
)

And I loaded the staticcontent app:

    'django.contrib.staticfiles',

The error I am getting from UWSGI:

Traceback (most recent call last):
  File "./ironman/wsgi.py", line 13, in <module>
    from whitenoise.django import DjangoWhiteNoise
  File "/usr/local/lib/python2.7/dist-packages/whitenoise/django.py", line 14, in <module>
    from django.contrib.staticfiles.storage import staticfiles_storage
  File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/storage.py", line 12, in <module>
    from django.core.cache import (
  File "/usr/local/lib/python2.7/dist-packages/django/core/cache/__init__.py", line 34, in <module>
    if DEFAULT_CACHE_ALIAS not in settings.CACHES:
  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 48, in __getattr__
    self._setup(name)
  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 42, in _setup
    % (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings are not configured. You must either define the environment variable DJANGO_SETTING
S_MODULE or call settings.configure() before accessing settings.

I've tried setting the CACHES and DEFAULT_CACHE_ALIAS in my settings.py but to no effect.

What am I doing wrong?

Thanks for all the help.

Michiel

whitenoise is missing the argparse dependency when installed for Python 2.6

When you install whitenoise for Python 2.6:

pip install whitenoise

It does not download the 'argparse' dependency automatically. Note that this library is included in the standard library for Python >= 2.7 and >= 3.2

If you try to use the whitenoise library without it (example from Graphite), you get:

Traceback (most recent call last):
  File "/opt/graphite/conf/graphite.wsgi", line 32, in <module>
    from whitenoise.django import DjangoWhiteNoise
  File "/usr/lib/python2.6/site-packages/whitenoise/django.py", line 32, in <module>
    from .gzip import compress, extension_regex, GZIP_EXCLUDE_EXTENSIONS
  File "/usr/lib/python2.6/site-packages/whitenoise/gzip.py", line 4, in <module>
    import argparse
ImportError: No module named argparse

ManifestStaticFilesStorage vs CachedStaticFilesStorage

Why do you use ManifestStaticFilesStorage instead of CachedStaticFilesStorage?

It seems like the Cached one would be better on a system like heroku, because the Django docs say that

This is mostly useful for situations in which you don’t have access to the file system.

What are the advantages of the Manifest?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.