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

django The STATICFILES_DIRS setting should not contain the STATIC_ROOT setting

I'm deploying a Django application on heroku. In my settings module, I have configured to host static files like STATIC_ROOT = os.path.join(BASE_DIR, 'static_my_project') STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR,…
Anuj TBE
  • 9,198
  • 27
  • 136
  • 285
14
votes
1 answer

Why is serving static files insecure

This might be a stupid question and have an obvious answer, but I was testing my 404 and 500 error handlers meaning that I had to switch debug to False. I went to Django admin page and noticed that static files are not being served. I understand…
Mirac7
  • 1,566
  • 4
  • 26
  • 44
14
votes
2 answers

Faster alternative to manage.py collectstatic (w/ s3boto storage backend) to sync static files to s3?

I have been using s3boto's S3BotoStorage as my static files backend and syncing files to my aws s3 buckets (staging and production) using ./manage.py collectstatic. It works fine. However it is painfully slow. In addition to my own static files…
B Robster
  • 40,605
  • 21
  • 89
  • 122
14
votes
5 answers

Django STATIC_URL is not working

Django version is 1.4. I had read the official document, and googled my problem. first I had followed the official document Managing static files added this in settings.py: TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.debug', …
thlgood
  • 1,275
  • 3
  • 18
  • 36
13
votes
3 answers

runserver can't serve media if MEDIA_URL is within STATIC_URL

My config is as follows: STATIC_URL = '/static/' MEDIA_URL = '/static/media/' And since I upgraded django 2.1 to 2.2 I get: "runserver can't serve media if MEDIA_URL is within STATIC_URL." django.core.exceptions.ImproperlyConfigured: runserver…
daino3
  • 4,386
  • 37
  • 48
13
votes
7 answers

Django CAN find my static files, Pycharm CANNOT resolve them

I do not think this is a duplicate. I have looked at a lot of answers to similar problems. Please note: This runs perfectly fine and django finds all static files. UPDATE: It looks like this is a PyCharm bug. If I move static into my app directory,…
Michael Bruce
  • 10,567
  • 2
  • 23
  • 31
13
votes
4 answers

Django | joined path is located outside of the base path component {% static img.thumbnail.url %}, Error 400 with whitenoise

I've finish my first app in Django and works perfectly, but still have pre-deployment problems since I set DEGUG=False ... Here is just to display an image in a template... T_T I was using this, but now it does'nt work when I use whitenoise to serve…
LauGau
  • 429
  • 1
  • 4
  • 14
12
votes
2 answers

Django StaticFiles and Amazon S3: How to detect modified files?

I'm using django staticfiles + django-storages and Amazon S3 to host my data. All is working well except that every time I run manage.py collectstatic the command uploads all files to the server. It looks like the management command compares…
Yuji 'Tomita' Tomita
  • 115,817
  • 29
  • 282
  • 245
12
votes
2 answers

Not finding static files django 1.9 gunicorn

I am on my way to deployment but when I switched to gunicorn from dev server my static files aren't being found. I ran collectstatic, and the files have been collected. note in my settings file I print the path to my static files. This is from my…
joel goldstick
  • 4,393
  • 6
  • 30
  • 46
12
votes
6 answers

Django : Static content not found

I have been breaking my head over this for a full day but can't figure out the problem. It happened after I copied my project from one machine to another. Settings.py STATIC_URL = '/static/' STATIC_ROOT = 'staticfiles' STATICFILES_DIRS = ( …
vivekanon
  • 1,813
  • 3
  • 22
  • 44
12
votes
4 answers

Django gives "GET /static/css/style.css HTTP/1.1" 304 0

ok so My Index.html is Kodeworms style.css .logged-out…
user2539745
  • 995
  • 2
  • 15
  • 24
12
votes
2 answers

Does django staticfiles skip the middleware?

I'm running a django 1.4.1 app. I didn't realize that just including django.contrib.staticfiles into INSTALLED_APPS in your settings is enough to get static files served while settings.DEBUG is True, i.e., you don't have to manually add anything to…
MrColes
  • 2,453
  • 1
  • 28
  • 38
11
votes
2 answers

django dev server, adding headers to static files

Using the django dev server (1.7.4), I want to add some headers to all the static files it serves. It looks like I can pass a custom view to django.conf.urls.static.static, like so: if settings.DEBUG: from django.conf.urls.static import static …
synic
  • 26,359
  • 20
  • 111
  • 149
11
votes
11 answers

django static file not loading

I have a problem. I did everything as described in this Django tutorial (EDIT: dead link, here's a working link), and everything is running fine, but CSS and images are not showing up/being applied. How do I get the CSS and images to show up…
SSR.P.S.das
  • 375
  • 1
  • 3
  • 14
11
votes
3 answers

A Simple View to Display/Render a Static image in Django

I am trying to find the most efficient way of displaying an image using django's template context loader. I have a static dir within my app which contains the image 'victoryDance.gif' and an empty static root dir at the project level (with…
JoshuaBox
  • 735
  • 1
  • 4
  • 16