Static media images are not displaying in Django

models.ImageField – these are media files, not static. They get affected by settings: MEDIA_ROOT, MEDIA_URL What the docs say about MEDIA_ROOT: Absolute filesystem path to the directory that will hold user-uploaded files. Warning MEDIA_ROOT and STATIC_ROOT must have different values. And media files should not be mixed with static files in folders. Media files should … Read more

Can I make STATICFILES_DIR same as STATIC_ROOT in Django 1.3?

No. In fact, the file django/contrib/staticfiles/finders.py even checks for this and raises an ImproperlyConfigured exception when you do so: “The STATICFILES_DIRS setting should not contain the STATIC_ROOT setting” The STATICFILES_DIRS can contain other directories (not necessarily app directories) with static files and these static files will be collected into your STATIC_ROOT when you run collectstatic. … Read more

Django give Error 500 for all static files like CSS and Images, when DEBUG is False

This is expected behavior. Django does not serve static files or media files in production. You should configure nginx, etc. to serve files. As is specified in the Static file development view section of the documentation: This view will only work if DEBUG is True. That’s because this view is grossly inefficient and probably insecure. … Read more

Django staticfiles not found on Heroku (with whitenoise)

With DEBUG=False, what originals use to work does not work for me anymore. However a fix by enabling whitenoise on MIDDLEWARE in settings.py solved it. Best to be just below SecurityMiddleware. MIDDLEWARE = [ ‘django.middleware.security.SecurityMiddleware’, ‘whitenoise.middleware.WhiteNoiseMiddleware’, # add this line #Other middleware… ] “` According to the docs, it actually needs to be enabled in … Read more

ValueError: Missing staticfiles manifest entry for ‘favicon.ico’

Try running: python manage.py collectstatic Does the test work now? If so, this might be the configuration causing a problem: STATICFILES_STORAGE = ‘whitenoise.django.GzipManifestStaticFilesStorage’ as of whitenoise v4 this will fail and you should use: STATICFILES_STORAGE = ‘whitenoise.storage.CompressedManifestStaticFilesStorage’ Related: https://stackoverflow.com/a/32347324/2596187 Check out the Django documentation: https://docs.djangoproject.com/en/1.11/ref/contrib/staticfiles/#django.contrib.staticfiles.storage.ManifestStaticFilesStorage.manifest_strict

Difference between static STATIC_URL and STATIC_ROOT on Django

STATIC_ROOT The absolute path to the directory where ./manage.py collectstatic will collect static files for deployment. Example: STATIC_ROOT=”/var/www/example.com/static/” now the command ./manage.py collectstatic will copy all the static files(ie in static folder in your apps, static files in all paths) to the directory /var/www/example.com/static/. now you only need to serve this directory on apache or … Read more