Coder Social home page Coder Social logo

jezdez / django-staticfiles Goto Github PK

View Code? Open in Web Editor NEW
126.0 4.0 33.0 621 KB

[Unmaintained] A Django app that provides helpers for serving static files, used in Django and Pinax.

Home Page: http://django-staticfiles.readthedocs.org/

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%

django-staticfiles's Introduction

django-staticfiles

This is a Django app that provides helpers for serving static files.

Django developers mostly concern themselves with the dynamic parts of web applications -- the views and templates that render new for each request. But web applications have other parts: the static media files (images, CSS, Javascript, etc.) that are needed to render a complete web page.

For small projects, this isn't a big deal, because you can just keep the media somewhere your web server can find it. However, in bigger projects -- especially those comprised of multiple apps -- dealing with the multiple sets of static files provided by each application starts to get tricky.

That's what staticfiles is for:

Collecting static files from each of your Django apps (and any other place you specify) into a single location that can easily be served in production.

The main website for django-staticfiles is github.com/jezdez/django-staticfiles where you can also file tickets.

Note

django-staticfiles is now part of Django (since 1.3) as django.contrib.staticfiles.

The django-staticfiles 0.3.X series will only receive security and data loss bug fixes after the release of django-staticfiles 1.0. Any Django 1.2.X project using django-staticfiles 0.3.X and lower should be upgraded to use either Django >= 1.3's staticfiles app or django-staticfiles >= 1.0 to profit from the new features and stability.

You may want to chose to use django-staticfiles instead of Django's own staticfiles app since any new feature (additionally to those backported from Django) will be released first in django-staticfiles.

Installation

  • Use your favorite Python packaging tool to install staticfiles from PyPI, e.g.:

    pip install django-staticfiles
    

    You can also install the in-development version of django-staticfiles with pip install django-staticfiles==dev.

  • Added "staticfiles" to your INSTALLED_APPS setting:

    INSTALLED_APPS = [
        # ...
        "staticfiles",
    ]
    
  • Set your STATIC_URL setting to the URL that handles serving static files:

    STATIC_URL = "/static/"
    
  • In development mode (when DEBUG = True) the runserver command will automatically serve static files:

    python manage.py runserver
    
  • Once you are ready to deploy all static files of your site in a central directory (STATIC_ROOT) to be served by a real webserver (e.g. Apache, Cherokee, Lighttpd, Nginx etc.), use the collectstatic management command:

    python manage.py collectstatic
    

    See the webserver's documentation for descriptions how to setup serving the deployment directory (STATIC_ROOT).

  • (optional) In case you use Django's admin app, make sure the ADMIN_MEDIA_PREFIX setting is set correctly to a subpath of STATIC_URL:

    ADMIN_MEDIA_PREFIX = STATIC_URL + "admin/"
    

django-staticfiles's People

Contributors

brosner avatar dbinit avatar durden avatar idan avatar jezdez avatar pabluk avatar smileychris 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

django-staticfiles's Issues

kwargs problem with staticfiles.urls static() function

I came across this problem when modifying my site-wide urls.py to serve files under a media/ directory; to do so I needed to add a line like,

urlpatterns +=  static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

Of course, one needs to import the static function above; when I use the function from staticfiles.urls, I see a TypeError is thrown with the url() function, kwargs, and document_root. But when I use the static function from django.conf.urls.static, no problem. The only difference I can see between the two is the last line, the return statement. The staticfiles version passes **kwargs, and the django.conf version passes kwargs=kwargs.

Apps without models are ignored

Django-staticfiles' codebase makes use of models.get_apps() in two locations. This method only returns those apps which have models (not just models.py, but one or more actual model definitions).

In some cases, I may want to override an app's media, without providing new models.

I have provided two patches (sorry for bitbucket, google led me there first). I will not be offended if you find a more elegant solution (perhaps using an existing Django method?)

https://bitbucket.org/vanschelven/django-staticfiles/changeset/645a024c1760
https://bitbucket.org/vanschelven/django-staticfiles/changeset/bb5c7738d779

Klaas

ValueError: The file could not be found with staticfiles.storage.CachedStaticFilesStorage

Hi Janis,
I'm trying the new nice CachedStaticFilesStorage backend shipped on 1.1 release, but i'm facing an issue.
On a css file (from TinyMCE) there is the following css definition:

    background:url(img/horizontal.gif) no-repeat 0 -75px;
    [...]

When collecting the staticfile a ValueError is raised.
Here are the original path :

  • js/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css
  • js/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif

The converter is looking for the file : js/tiny_mce/plugins/inlinepopups/skins/clearlooks2/horizontal.gif. Thus the error. (The img path part is missing.)
IMHO, the issue is in https://github.com/jezdez/django-staticfiles/blob/master/staticfiles/storage.py#L152 where :
result = name_parts[:-1] + url_parts[-1:]
should be replaced by :
result = name_parts[:-1] + url_parts
What do you think ?
or:
result = name_parts[:-1] + url_parts[level:]
I wanted to provide a patch through a pull-request, but i don't know how to run the test suite...
What do you think ?

TemplateSyntaxError: Caught ValueError while rendering: The file 'img/logo.png' could not be found with <staticfiles.storage.CachedStaticFilesStorage object at 0x7f296d7fa250>.

Hi,
I'm experiencing some errors when using django-staticfiles with CachedStaticFilesStorage storage.
After delving into the source code, it looks like that when a cache key is evicted from the cache, the CachedFilesMixin.url method - called by the static template tag - is having hard time to regenerate it, since it does not provide the content of the targeted file when calling CachedFilesMixin.hashed_name.
I'll try to provide a patch to fix this issue.
Regards.

Ordering of directories listed in STATICFILES_DIRS is not preserved

When the directories are loaded into the FileSystemFinder object, it adds it to a set which does not preserve the order in which they are added. Consequently, when looking for files in the FileSystemFinder class, they are not necessarily looked up in the order specified in the settings file. If two directories listed in STATICFILES_DIRS contain the same file, it is not obvious to the programmer which will be chosen and there is no easy way for the programmer to specify (inherit filesystemfinder and overide in the settings seems to be the only way). I know that in the past this was not the case.

Fix ImportError on Django 1.5.5

In Django 1.5.5, WSGIServerException was removed. Because that was removed, the runserver command can no longer import the Exception.

I'm not sure what you think the best way to fix this would be, as the django-staticfiles runserver command tries to pretty-print the exception, but I'm happy to create the pull request if you've got a preference.

Easier configuration for CDN backends

Background - my need:

  1. All files managed & distributed locally
  2. Servers use CachedFilesMixin to generate URLs with hash-busters which will be served from static.example.org which is a simple alias for S3 with far-futures expires, CORS headers, etc.
  3. During deployment, collectstatic populates S3 normally. This ensures that even during a rolling upgrade across multiple servers, there's no way for a response to reference a file before it's been collected to S3.

I have this implemented using django-storages' S3BotoBackend.

This required a storage subclasses to prevent leaking the S3 internal URLs out to the public:

class PublicS3BotoStorage(S3BotoStorage):
    def url(self, name):
        name = self._normalize_name(self._clean_name(name))
        return urljoin(settings.STATIC_URL, name)


class CachedS3StaticFileStorage(CachedFilesMixin, PublicS3BotoStorage):
    def __init__(self, bucket=None, *args, **kwargs):
        kwargs.update({'bucket': settings.STATICFILES_BUCKET_NAME})
        super(CachedS3StaticFileStorage, self).__init__(*args, **kwargs)

This feels a little baroque but it works. Unfortunately, it also ensures that every {% static %} call will hit S3 rather than the local filesystem which lowers performance and ensures the exact problem I was hoping to avoid if you have multiple versions running:

  1. version1 uploads both the hashed and unhashed file (e.g. common.css). Initially this works & the hashed name translation is cached locally
  2. version2 is uploaded to a different cluster, creating a new hashed file and clobbering the unhashed common.css
  3. The first server cluster's cache expires and it goes to regenerate the hash, getting version2 rather than the expected version1 installed locally.

I've rearchitected a bit to simply always use CachedStaticFilesStorage and simply call s3cmd sync during deployment but this feels like something which should be easier to do with staticfiles. After some thought it seems like this could simply be solved by extending collectstatic to either have a target or building a storage backend which would copy collected files to multiple backends. In either case it would also be extremely useful to either outright prevent uploading the unhashed files or have a regexp whitelist to avoid mixing versioned and unversioned resources unless the user has a good reason.

Django 1.2.7 doesn't work with django-staticfiles 1.2.1

I have a problem with django-staticfiles-1.2.1 and django-1.2.7 using get_static_prefix templatetag, it doesn't return my STATIC_URL setting. But with the same configuration and django-staticfiles-1.1 it's works.

I test it with 2 isolated virtualenvs and a fresh install of Django and staticfiles

My settings.py:

INSTALLED_APPS = [
    # ...
    "staticfiles",
]
STATIC_URL = '/static/'

Virtualenv 1:

$ pip freeze
Django==1.2.7
argparse==1.2.1
distribute==0.6.24
django-staticfiles==1.1
wsgiref==0.1.2

Here, as expected, I get u'/static/'

$ python manage.py shell
>>> from django.template import Template, Context
>>> t = Template("""{%load static %}{% get_static_prefix %}""")
>>> t.render(Context({}))
u'/static/'

Virtualenv 2:

$ pip freeze
Django==1.2.7
argparse==1.2.1
distribute==0.6.24
django-appconf==0.5
django-staticfiles==1.2.1
wsgiref==0.1.2

Here's the problem, I get u''

$ python manage.py shell
>>> from django.template import Template, Context
>>> t = Template("""{%load static %}{% get_static_prefix %}""")
>>> t.render(Context({}))
u''

Is it normal? and do I need to change my settings?

Cheers!

URL rewrite errors

URL rewriting in css, fail on many common case use in css like ie hack like :

url(web-font.eot?#iefix)

And SVG id in url :

url(web-font.svg#webfontIyfZbseF)

And also try to rewrite data-uri :

url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAADJoAA0AAAAAR2QAAQAAAAAAAAAAAAA)

And it's a common pratice used for cross-platform web-fonts support.

Version 1.0.1 in PyPi

I noticed that with the release of django-staticfiles 1.1, older versions have been completely removed from PyPi. This is problematic, as version 1.1 is not compatible with Python 2.4.

I certainly understand dropping backwards compatibility with Python 2.4 in new versions, but at the very least older versions should remain available so that those of us who must use old versions of Python still have access to it. I've satisfied my dependencies by getting the source from github and building a package, but I imagine others will have this issue as well.

collectstatic can overwrite files it skipped, resulting in different behaviour in development and production

Given the following settings:

STATICFILES_FINDERS = (
    'staticfiles.finders.FileSystemFinder',
    'staticfiles.finders.AppDirectoriesFinder',
)

If you have two files called css/body.css one in STATIC_DIR/css/body.css and an app with (a different) static/css/body.css.

I would expect that staticfiles.views.serve always serves the same file as after running collectstatic.

In some rare conditions however this does not work. I've been able to reproduce it by doing the following:

First creat css/body.css in the project, no external apps yet, and run collectstatic.
Then I add an external app (to INSTALLED_APPS), that has a newer css/body.css and run collectstatic again.

The file is now copied from the external app, overwriting the one from the project.

It seems to me that copy_file/link_file should also check self.unmodified_files when deciding to skip.

models/appconf can't get settings.MEDIA_URL and MEDIA_ROOT

and probably more:

www-data@sologroup-01:/usr/local/src/sologroup.gs$ bin/django shell
Traceback (most recent call last):
  File "bin/django", line 18, in <module>
    djangorecipe.manage.main('sologroup.production')
  File "/usr/local/src/sologroup.gs/eggs/djangorecipe-0.99-py2.6.egg/djangorecipe/manage.py", line 16, in main
    management.execute_manager(mod)
  File "/usr/local/src/sologroup.gs/eggs/Django-1.2.5-py2.6.egg/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/usr/local/src/sologroup.gs/eggs/Django-1.2.5-py2.6.egg/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/src/sologroup.gs/eggs/Django-1.2.5-py2.6.egg/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/src/sologroup.gs/eggs/Django-1.2.5-py2.6.egg/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/usr/local/src/sologroup.gs/eggs/Django-1.2.5-py2.6.egg/django/core/management/base.py", line 351, in handle
    return self.handle_noargs(**options)
  File "/usr/local/src/sologroup.gs/eggs/Django-1.2.5-py2.6.egg/django/core/management/commands/shell.py", line 18, in handle_noargs
    loaded_models = get_models()
  File "/usr/local/src/sologroup.gs/eggs/Django-1.2.5-py2.6.egg/django/db/models/loading.py", line 167, in get_models
    self._populate()
  File "/usr/local/src/sologroup.gs/eggs/Django-1.2.5-py2.6.egg/django/db/models/loading.py", line 61, in _populate
    self.load_app(app_name, True)
  File "/usr/local/src/sologroup.gs/eggs/Django-1.2.5-py2.6.egg/django/db/models/loading.py", line 78, in load_app
    models = import_module('.models', app_name)
  File "/usr/local/src/sologroup.gs/eggs/Django-1.2.5-py2.6.egg/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/usr/local/src/sologroup.gs/lib/python2.6/site-packages/staticfiles/models.py", line 10, in <module>
    class StaticFilesConf(AppConf):
  File "/usr/local/src/sologroup.gs/lib/python2.6/site-packages/appconf.py", line 70, in __new__
    new_class._configure()
  File "/usr/local/src/sologroup.gs/lib/python2.6/site-packages/appconf.py", line 91, in _configure
    value = callback(value)
  File "/usr/local/src/sologroup.gs/lib/python2.6/site-packages/staticfiles/models.py", line 50, in configure_url
    if url == self.MEDIA_URL:
  File "/usr/local/src/sologroup.gs/lib/python2.6/site-packages/appconf.py", line 145, in __getattr__
    (name, self._meta.holder_path))
AttributeError: MEDIA_URL not found. Use 'django.conf.settings' instead.

if I replace self.MEDIA_URL to settings.MEDIA_URL it work.

docs update required - ADMIN_MEDIA_PREFIX issue when admin app is not used

if django project doesn't use admin app and ADMIN_MEDIA_PREFIX is not set it defaults to /media/ and causes problem with serving of media/static files.

issue can be solved by settings ADMIN_MEDIA_PREFIX=/media/static/admin/ or something different than MEDIA_URL although it's not actually used.

tested with django-staticfiles==0.3.4 and Django==1.2.5

UnicodeEncodeError: 'ascii' codec can't encode character u'\uf003'

While executing 'manage.py collectstatic' I recieved the following trace:

Copying '/home/erwin/.virtualenvs/django-base/lib/python2.6/site-packages/django_crystal_small/static/crystal/48x48/apps/hibernate.png'
Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    execute_manager(settings)
  File "/home/erwin/.virtualenvs/django-base/lib/python2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/home/erwin/.virtualenvs/django-base/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/erwin/.virtualenvs/django-base/lib/python2.6/site-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/erwin/.virtualenvs/django-base/lib/python2.6/site-packages/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/home/erwin/.virtualenvs/django-base/lib/python2.6/site-packages/django/core/management/base.py", line 351, in handle
    return self.handle_noargs(**options)
  File "/home/erwin/.virtualenvs/django-base/lib/python2.6/site-packages/staticfiles/management/commands/collectstatic.py", line 88, in handle_noargs
    self.copy_file(path, prefixed_path, storage, **options)
  File "/home/erwin/.virtualenvs/django-base/lib/python2.6/site-packages/staticfiles/management/commands/collectstatic.py", line 190, in copy_file
    self.log("Copying '%s'" % source_path, level=1)
  File "/home/erwin/.virtualenvs/django-base/lib/python2.6/site-packages/staticfiles/management/commands/collectstatic.py", line 107, in log
    self.stdout.write(msg)
UnicodeEncodeError: 'ascii' codec can't encode character u'\uf003' in position 130: ordinal not in range(128)
(django-base)erwin@wpl082:~/Projects/django_base$ git freeze

This probably happens while coping the file home&food.png, note the '&' char.
Using 'django-staticfiles' version 1.0b1 and 'django-crystal-small' version '2011.2.13'.

CachedFilesMixin url_converter creates url for incorrect file

I think CachedFilesMixin has a bug somewhere around lines (storage.py lines 200-213)

            url_parts = url.split('/')
            parent_level, sub_level = url.count('..'), url.count('/')
            if url.startswith('/'):
                sub_level -= 1
                url_parts = url_parts[1:]
            if parent_level or not url.startswith('/'):
                start, end = parent_level + 1, parent_level
            else:
                if sub_level:
                    if sub_level == 1:
                        parent_level -= 1
                    start, end = parent_level, sub_level - 1
                else:
                    start, end = 1, sub_level - 1
            joined_result = '/'.join(name_parts[:-start] + url_parts[end:])

In my case I enter this block with: name_parts = [u'css', u'plugins', u'toaster.css'] and url = '/assets/images/icons/fancy_close.png' and expect joined_result in the end be images/icons/fancy_close.png, but instead it is icons/fancy_close.png.

For a url='/assets/images/glyphicons-halflings.png' it seems to work correct.

Add a way to rebuild staticfiles cache

I want to use collectstatic with CachedStaticFilesStorage to build my staticfiles on my machine and upload the result on production servers, but I have no way to rebuild the cache once uploaded. This could be useful for heroku or other similar setup.

Maybe we should add an option, or another command to be able to rebuild the cache from what's inside STATIC_ROOT. Or you might have a better idea ๐Ÿ˜‰

django 1.2 can not use 1.1+

It is not clear to me whether or not Django 1.2 is supposed to be able to use django-staticfiles 1.1+

The changelog for v1.1 says:
"Updated list of supported Django versions: 1.2.X, 1.3.X and 1.4.X"

However with Django 1.2.7 and django-staticfiles v1.1.2, configured with:

in settings.py

STATIC_ROOT = os.path.join(ROOT_PATH, '..', 'docroot')

STATIC_URL = '/static-new/'

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

Running collectstatic returns:

% python film/manage.py collectstatic -h
Traceback (most recent call last):
  File "film/manage.py", line 11, in <module>
    execute_manager(settings)
  File "/home/anand/Work/<company>/<org>-env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/home/anand/Work/<company>/<org>-env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/anand/Work/<company>/<org>-env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 261, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/home/anand/Work/<company>/<org>-env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 68, in load_command_class
    return module.Command()
  File "/home/anand/Work/<company>/<org>/film/apps/staticfiles/management/commands/collectstatic.py", line 54, in __init__
    self.storage.path('')
  File "/home/anand/Work/<company>/<org>-env/local/lib/python2.7/site-packages/django/utils/functional.py", line 276, in __getattr__
    self._setup()
  File "/home/anand/Work/<company>/<org>/film/../film/apps/staticfiles/storage.py", line 262, in _setup
    self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)()
  File "/home/anand/Work/<company>/<org>-env/local/lib/python2.7/site-packages/django/utils/functional.py", line 277, in __getattr__
    return getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'STATICFILES_STORAGE'

This is because their is no default settings.py file within the staticfile app (as in v1.0.1).

Using staticfiles 1.0.1 and the collectstatic command works fine.

Getting Error!

Dj version: 1.6
Using : django.contrib.staticfiles

While post_process getting the following error in some point -

Post-processed 'websites/bespoke/fonts/specimen_files/specimen_stylesheet.e2cb9ea14b54.css.gz' as 'websites/bespoke/fonts/specimen_files/specimen_stylesheet.e2cb9ea14b54.css.gz'
Post-processed 'websites/dfm/js/olympics/jquery.countdown.a085c11d8052.js.gz' as 'websites/dfm/js/olympics/jquery.countdown.a085c11d8052.js.gz'
Post-processed 'websites/entertainow/css/fonts/stylesheet.7b7585a64514.css.gz' as 'websites/entertainow/css/fonts/stylesheet.7b7585a64514.css.gz'
Post-processed 'websites/fargo/img/My Financial Guide โ€“ Financial Literacy Tools and Resources โ€“ Wells Fargo_files/jquery-ui.35fa8b687574.js.gz' as 'websites/fargo/img/My Financial Guide โ€“ Financial Literacy Tools and Resources โ€“ Wells Fargo_files/jquery-ui.35fa8b687574.js.gz'
Post-processed 'websites/fargo/img/My Financial Guide โ€“ Financial Literacy Tools and Resources โ€“ Wells Fargo_files/jquery.fb4562709c25.js.gz' as 'websites/fargo/img/My Financial Guide โ€“ Financial Literacy Tools and Resources โ€“ Wells Fargo_files/jquery.fb4562709c25.js.gz'
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/newscred/projects/python/pycms/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/Users/newscred/projects/python/pycms/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/newscred/projects/python/pycms/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/newscred/projects/python/pycms/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/Users/newscred/projects/python/pycms/lib/python2.7/site-packages/django/core/management/base.py", line 415, in handle
    return self.handle_noargs(**options)
  File "/Users/newscred/projects/python/pycms/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 167, in handle_noargs
    collected = self.collect()
  File "/Users/newscred/projects/python/pycms/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 118, in collect
    for original_path, processed_path, processed in processor:
  File "/Users/newscred/projects/python/cms/cms/pipeline/pipeline_storage.py", line 14, in post_process
    for name, hashed_name, processed in super(GZipPipelineStorage, self).post_process(paths, dry_run, **options):
  File "/Users/newscred/projects/python/pycms/lib/python2.7/site-packages/pipeline/storage.py", line 77, in post_process
    if not matches_patterns(path, self.gzip_patterns):
  File "/Users/newscred/projects/python/pycms/lib/python2.7/site-packages/django/contrib/staticfiles/utils.py", line 14, in matches_patterns
    if fnmatch.fnmatchcase(path, pattern):
  File "/Users/newscred/projects/python/pycms/lib/python2.7/fnmatch.py", line 79, in fnmatchcase
    return _cache[pat].match(name) is not None
TypeError: expected string or buffer

Enabling staticfiles prevents using --noreload option of runserver

Hi there.

I've realised today that adding staticfiles to my installed apps prevents the --noreload switch from working on the manage.py runserver command (I use --noreload for my debugger).

It looks as though the runserver management replacement provided with staticfiles doesn't support this switch. Is this a known trade off?

I've done a test with Django 1.3 using contrib.staticfiles and noreload works fine, so I guess I can just hang on for that if need be. :)

Thanks loads for a great app.

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.