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
501
votes
21 answers

Why does DEBUG=False setting make my django Static Files Access fail?

Am building an app using Django as my workhorse. All has been well so far - specified db settings, configured static directories, urls, views etc. But trouble started sneaking in the moment I wanted to render my own beautiful and custom 404.html and…
JWL
  • 13,591
  • 7
  • 57
  • 63
209
votes
19 answers

How to get a favicon to show up in my django app?

I just want to drop the favicon.ico in my staticfiles directory and then have it show up in my app. How can I accomplish this? I have placed the favicon.ico file in my staticfiles directory, but it doesn't show up and I see this in my log: 127.0.0.1…
tadasajon
  • 14,276
  • 29
  • 92
  • 144
167
votes
8 answers

Django get the static files URL in view

I'm using reportlab pdfgen to create a PDF. In the PDF there is an image created by drawImage. For this I either need the URL to an image or the path to an image in the view. I managed to build the URL but how would I get the local path to the…
olofom
  • 6,233
  • 11
  • 37
  • 50
163
votes
5 answers

STATIC_ROOT vs STATIC_URL in Django

I am confused by static root and want to clarify things. To serve static files in Django, the following should be in settings.py and urls.py: import os PROJECT_DIR=os.path.dirname(__file__) 1. Absolute path to the directory in which static files…
user993563
  • 18,601
  • 10
  • 42
  • 55
141
votes
4 answers

Differences between STATICFILES_DIR, STATIC_ROOT and MEDIA_ROOT

What are the differences of these three static url? I am not sure if I am right, I am using the MEDIA_ROOT to store my uploaded photos (via models.ImageField()) However, I created a JS script to my admin and in admin.py. I defined the media as…
dev-jim
  • 2,404
  • 6
  • 35
  • 61
139
votes
4 answers

What's the point of Django's collectstatic?

In Django, the convention is to put all of your static files (i.e css, js) specific to your app into a folder called static. So the structure would look like this: mysite/ manage.py mysite/ --> (settings.py, etc) myapp/ --> (models.py,…
user5732453
133
votes
6 answers

django 1.5 - How to use variables inside static tag

I'm currently migrating all the static files references in my project to the new {% static %} tag that django 1.5 introduced, but I'm having a problem, in some places I use variables to get the content. With the new tag I can't, is there any way to…
CastleDweller
  • 8,204
  • 13
  • 49
  • 69
113
votes
9 answers

How to override css in Django Admin?

I want to change certain css in admin django like base.css. Is it better to change directly in the django library? How can I override it in the best way?
rajan sthapit
  • 4,194
  • 10
  • 42
  • 66
86
votes
16 answers

ValueError: Missing staticfiles manifest entry for 'favicon.ico'

I'm getting a ValueError when running python manage.py test. My project is named fellow_go, and I'm currently working on an App called pickup. Please note that this error is added in a relatively recent commit to Django: Fixed #24452 -- Fixed…
nalzok
  • 14,965
  • 21
  • 72
  • 139
86
votes
18 answers

Django won't refresh staticfiles

I have a JavaScript file referenced on a django template: I made some changes to that js file. Then, I refresh the page and I can't see the changes happen. If I remove the JavaScript from the…
Alejandro Veintimilla
  • 10,743
  • 23
  • 91
  • 180
86
votes
9 answers

Unable to perform collectstatic

I am new to django ! When I use the command python manage.py collectstatic I get this error django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path But I can…
user3383301
  • 1,891
  • 3
  • 21
  • 49
59
votes
10 answers

The STATICFILES_DIRS setting should not contain the STATIC_ROOT setting

I'm using Django 1.7. When deploying my site to a Production server and running collectstatic, I get following error message: django.core.exceptions.ImproperlyConfigured: The STATICFILES_DIRS setting should not contain the STATIC_ROOT setting I…
SaeX
  • 17,240
  • 16
  • 77
  • 97
52
votes
1 answer

Managing static files for multiple apps in Django

I am developing a Django (1.3) project composed of many applications. Each application has its own static files under its own static directory. Moreover, I have added a directory called project_static which should contain static files which are…
Andrea
  • 20,253
  • 23
  • 114
  • 183
51
votes
5 answers

Django serve static index.html with view at '/' url

I have my index.html in /static/ folder. My django app is running ok when i try: http://127.0.0.1:8000/index.html But i want to acces index.html by url: http://127.0.0.1:8000/ I wrote a view and it works: class IndexView(TemplateView): …
Feanor
  • 3,568
  • 5
  • 29
  • 49
47
votes
1 answer

Can I make STATICFILES_DIR same as STATIC_ROOT in Django 1.3?

I'm using Django 1.3 and I realize it has a collectstatic command to collect static files into STATIC_ROOT. Here I have some other global files that need to be served using STATICFILES_DIR. Can I make them use the same dir ? Thanks.
WoooHaaaa
  • 19,732
  • 32
  • 90
  • 138
1
2 3
82 83