Hi guys,
I am new here so I hope I following the rules, and if I am not sorry in advance.
I have issue and I cant find anything about that.
In production when I set DEBUG to False I have strange error. I have 7-8 projects with same setup and all working good but this one. I am using Django 3.2.19 and python 3.9 on shared hosting with cpanel. Also I am using webpack and thumbnails. My settings setup looks like this:
STATIC_ROOT = '/home/user/public_html/static/'
STATIC_URL = '/static/'
STATICFILES_DIRS = (
'/home/user/public_html/project/frontend/build',
'/home/user/public_html/project/shop/static',
)
MEDIA_ROOT = '/home/user/public_html/media'
MEDIA_URL = '/media/'
As always before I set DEBUG to False I use collectstatic.
Firstly I thought it has something with my stage and because its a subdomain,
but after when I set project live, I had same problem.
In console I get this errors:
Refused to apply style from ‘://domain/static/css/app.css’ because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Refused to execute script from ‘://domain/static/js/runtime.js’ because its MIME type (‘text/html’) is not executable, and strict MIME type checking is enabled.
GET ://domain/static/js/runtime.js net::ERR_ABORTED 404 (Not Found)
://domain/shop/300w 404 (Not Found)
and lot more.
Headers for example:
Request URL:
://domain/static/js/app.js
Request Method:
GET
Status Code:
404 Not Found
And I managed to get static files with whitenoise but still doesnt getting media files…
I drain all solutions and examples and I couldnt fix it.
And I am repeating, I have 7 or 8 projects live with same setup and all work fine.