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
8
votes
2 answers

How to reference static files in a handlebars-django template

Summary: How should I reference static files in a handlebars-part in a django template? I can use handlebars if I use verbatim tags, but then I can't use django's static tag. Details While converting an app to Django, I came across a part that uses…
Nanne
  • 64,065
  • 16
  • 119
  • 163
8
votes
2 answers

Django: Is "collectstatic" supposed to collect media files as well?

I dont know if I am confusing the purpose of collectstatic. Here's my settings module: # BASE_DIR is the location of my django project folder STATIC_URL = '/this.static/' STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR),…
8
votes
1 answer

What is the recommended directory layout for third-party static files in Django projects?

For third-party (jquery) code in my Django project, I've adopted a directory structure for my static files that puts all third-party files in a separate lib sub-directory. More specifically, this is what my directory tree currently looks…
coder123
  • 9,267
  • 5
  • 16
  • 13
8
votes
1 answer

Reference Static Images From Javascript in Django

So I'm working on a Django project and am trying to figure out how to get Javascript to be able to render images from my static directory. I've modified my settings.py to load static files (images, js, etc.) from myproject/static and my templates…
drodman
  • 645
  • 1
  • 10
  • 19
8
votes
3 answers

Using static files in custom 404/500 pages in Django

I would like to use some custom CSS and images on my custom 404/500 pages that I made. Django doesn't include the STATIC_URL variable in those pages though. What would be the best way to accomplish this? I also tried making a custom 404/500 view…
heri0n
  • 1,459
  • 3
  • 19
  • 33
8
votes
2 answers

How do I ignore static files of a particular app only with collectstatic?

Just to get this out of the way, if at all possible, I'd like to do this without nesting them all inside a directory with the app's name inside the app's static folder, it feels redundant. If it's the only way then such is life. I am…
JamesH
  • 165
  • 1
  • 9
7
votes
4 answers

Django: How can I gzip staticfiles served in dev mode?

My django.contrib.staticfiles settings seems to be ok as all static files get served as expected. However, eg. /static/*.css files do not get gzipped although I have GZipMiddleware turned on. Fyi. my views html actually does get gzipped, only the…
Carsten
  • 539
  • 4
  • 10
7
votes
2 answers

django.core.exceptions.SuspiciousFileOperation: The joined path is located outside of the base path component

This worked fine everytime used to do django websites but this time it is giving me an error. Settings.py STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'portfolio/static/') ] STATIC_ROOT = os.path.join(BASE_DIR , 'static') STATIC_URL =…
7
votes
1 answer

collecstatic does not push to files S3

EDIT: I have found that removing import django_heroku from my settings.py file allows me to push my static files to my AWS bucket. When I uncomment import django_heroku, collectstatic then pushes my files to the staticfiles folder. manage.py…
7
votes
1 answer

Django Debug=False whitenoise not working

I am trying to deploy my fully functional (when local and Debug=True) site to Heroku. When I use the default Django staticfile_storage settings, my site appears live but without any static files (css, images, etc). The admin panel works but it…
cssidy
  • 395
  • 6
  • 16
7
votes
1 answer

UncompressableFileError: 'scripts/app.js' isn't accessible via COMPRESS_URL ('http://my-bucket.s3-us-west-2.amazonaws.com/') and can't be compressed

I'm trying to use django-compressor and django-storages-redux together with django staticfiles and Amazon S3. These are my settings: STATIC_URL = COMPRESS_URL = 'http://my-bucket.s3-us-west-2.amazonaws.com/' STATIC_ROOT = os.path.join(BASE_DIR,…
7
votes
1 answer

Django pipeline can't find static css files

I've configured django-pipeline to compress js and css. While js works, it is not able to find css files. The files can be found using findstatic command. I'm testing it with just one file now which has a single css rule. Here's my…
Apoorv Parijat
  • 861
  • 1
  • 10
  • 16
7
votes
1 answer

Django-compressor / django-storages links being wrongly cached; expiring

I have a Heroku setup with django-compressor compressing my CSS and JS files. My default cache backend is set up with memcached (actually Memcachier when on Heroku). My static files are being served on an Amazon S3 instance (handled by…
7
votes
1 answer

STATIC_ROOT in Django on Server

I'm 2hours stuck in a issue about STATIC_URL and STATIC_ROOT when I try to make run the webapp on my server at webfactional. when I load the webpage all the requests works well, except by the fact that any link with {{ STATIC_URL}} is working or…
cleliodpaula
  • 819
  • 2
  • 11
  • 27
7
votes
1 answer

Django/mod_wsgi OSError: [Errno 13] Permission denied: 'static' when DEBUG = OFF

I have a Django 1.4 application on a Centos 6.2 server (running apache, mysql, php) using mod_wsgi with my project deployed in a virtual env. The application itself is one I've been using for several years on a hosted service and I am now deploying…
CitizenS
  • 87
  • 1
  • 6