To see the static files (images and pdf), I defined STATIC_DIRS with the values containing directories’ names where I upload those files:
STATICFILES_DIRS = (
'/home/alessandro/Scrivania/progetto/media/photos/custodia/',
'/home/alessandro/Scrivania/progetto/media/definitiva/',
'/home/alessandro/Scrivania/progetto/media/proforma/',
'/home/alessandro/Scrivania/progetto/media/fpdf/';
)
In STATIC_URL:
STATIC_URL = '/static/'
In Installed Apps:
INSTALLED_APPS = (
....
'django.contrib.staticfiles',
)
The permissions are 0777.
Now When I want to see the image or pdf files, I get this error message.
Page not found
I am using this URL:
http://127.0.1:8000/home/alessandro/Scrivania/progetto/media/photos/custodia/powered_by.png
Any Ideas? Why is this problem occuring?
By default, static and media files are not served with Django’s builtin dev server. If you want it to serve those files directly, add
staticfiles_urlpatternsand aMEDIA_URLpattern to your urlconf.This will only work if
DEBUGisTrue.For more information, refer to the corresponding docs.
Note: You should not do this in production! Always use a separate webserver for static files in production mode.