Questions tagged [django-staticfiles]

A Django app that provides helpers for serving static files.

django-staticfiles is a Django app that provides helpers for serving static files.

1241 questions
46
votes
5 answers

Python Django: You're using the staticfiles app without having set the STATIC_ROOT setting

I'm trying to deploy my Django application to the web, but I get the following error: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path However, I did in my production.py: from django.conf import…
Henry Zhu
  • 2,488
  • 9
  • 43
  • 87
44
votes
10 answers

Invalid block tag: 'static'

Server returned TemplateSyntaxError at / Invalid block tag: 'static' on this line: . The whold html file is like this (it's an html file {% include %}ed by another one): {% load staticfiles %}
Yan Yang
  • 1,804
  • 2
  • 15
  • 37
41
votes
3 answers

Heroku & Django: "OSError: No such file or directory: '/app/{myappname}/static'"

I have a Django app on Heroku. I am having some problems with static files (they are loading in one Heroku environment but not another), so I tried the debug command recommended here. $ heroku run python manage.py collectstatic --noinput Running…
RexE
  • 17,085
  • 16
  • 58
  • 81
40
votes
10 answers

django static files versioning

I'm working on some universal solution for problem with static files and updates in it. Example: let's say there was site with /static/styles.css file - and site was used for a long time - so a lot of visitors cached this file in browser Now we…
Djangonaut
  • 5,511
  • 7
  • 40
  • 53
40
votes
11 answers

Turn off caching of static files in Django development server

Is there an easy way to turn off caching of static files in Django's development server? I'm starting the server with the standard command: python manage.py runserver I've got settings.py configured to serve up static files from the /static…
aaronstacy
  • 6,189
  • 13
  • 59
  • 72
29
votes
4 answers

How to configure django-compressor and django-staticfiles with Amazon's S3?

I'm trying to setup django-compressor and django-staticfiles so that the compressed CSS/Javascript and images are served from Amazon's S3. I've managed to setup staticfiles using S3 as the backend so it's collectstatic command sends the files to S3…
ghickman
  • 5,893
  • 9
  • 42
  • 51
29
votes
6 answers

How to include JavaScript in Django Templates?

I'm working on a project and following the documentation. I didn't succeed to include javascript. Here is my settings: STATIC_URL = '/static/' STATICFILES_DIRS = ( os.path.join(BASE_DIR, "static"), ) STATIC_ROOT = '/static/' TEMPLATE_DIRS =…
BoumTAC
  • 3,531
  • 6
  • 32
  • 44
28
votes
3 answers

What's the difference between STATIC_URL and STATIC_ROOT in Django?

I'm somewhat confused as to what the difference is between STATIC_URL and STATIC_ROOT in Django's 'staticfiles' app. I believe I understand what the STATIC_ROOT is: it's essentially the location on the server where the staticfiles' collectstatic…
Izzo
  • 4,461
  • 13
  • 45
  • 82
25
votes
2 answers

Django whitenoise drawback

There are many article describing the pros of using whitenoise instead of other configuration for serving static files. But the information about it's cons is kind of hard to find Is there any cons or drawbacks of using whitenoise for serving static…
hashlash
  • 897
  • 8
  • 19
25
votes
1 answer

Django pipeline Cache Busting is not Updating Cached File/Hash

Basically, the hash on the cache busting file is not updating. class S3PipelineStorage(PipelineMixin, CachedFilesMixin, S3BotoStorage): pass PIPELINE_JS = { 'main.js': { 'output_filename': 'js/main.min.js', 'source_filenames': [ …
Ben
  • 15,010
  • 11
  • 58
  • 90
25
votes
9 answers

Amazon Elastic Beanstalk not serving django static files

I am trying to put up a simple django app on elastic beanstalk. I thought I had the static parts of the app figured out as it works with heroku and on a server that was set up manually. In debugging I even checked in a pushed the static files in…
25
votes
3 answers

South + Django 1.4 Database error

I have just installed my Django project on a new system, and installed Django 1.4. However when I try to run manage.py runserver or manage.py syncdb I get this error from South: Validating models... Unhandled exception in thread started by
saul.shanabrook
  • 3,068
  • 3
  • 31
  • 49
24
votes
5 answers

Django-Compressor throws UncompressableFileError

I'm using django-compressor and django-staticfiles (the external version, I'm on Django 1.2). When I try to load my site, I get an error: TemplateSyntaxError: Caught UncompressableFileError while rendering: 'css/facebox.css' isn't accesible via…
Chris Lawlor
  • 47,306
  • 11
  • 48
  • 68
24
votes
3 answers

Serving favicon.ico with Django. Why does settings.MEDIA_URL with django.views.generic.simple.redirect_to only work on dev environment?

I found this solution for serving favicon.ico with django. (r'^favicon\.ico$', 'django.views.generic.simple.redirect_to', {'url': settings.MEDIA_URL+'images/favicon.ico'}), I do not understand why it only works for the development server. Going…
Clash
  • 4,896
  • 11
  • 47
  • 67
23
votes
4 answers

You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path

I have gone through every other answer and cannot seem to get anything to work for me. I am following a tutorial and trying to push my master branch to heroku and get the error You're using the staticfiles app without having set the STATIC_ROOT…
ratrace123
  • 976
  • 4
  • 12
  • 24
1
2
3
82 83