Static file Failed to load resource (404 error)


Version : Koa

I found the static file 404 error in LMS administration (https://lms/admin).
I do :
python manage.py lms --settings=production collectstatic --noinput;

When the command is done , the CMS administration (https://cms/admin) has static file 404 error.
(Before I do the lms’s collectstatic cmd , the CMS administration is good.)
I do :
python manage.py cms --settings=production collectstatic --noinput;

After cms collectstatic cmd is done , the LMS administration has static file 404 error .

Is there anyone meet this problem ? How should I do to fix this?

Hello @guangyaw :wave:

This is interesting. Could you please check the settings.STATIC_ROOT from a cms and lms shell? Isn’t it possible that the STATIC_ROOT is different for the two?

I didn’t modify the setting in both lms.yml and studio.yml.
I already double confirm and the settings is:

STATIC_ROOT_BASE: /edx/var/edxapp/staticfiles

@guangyaw I don’t think that both should point to the same directory as collectstatic command would remove/overwrite the already existing files in the directory. In case --noinput provided, nothing will be prompted to you to let you abort the process.

The settings for me looks like the following:

# Studio
>>> from django.conf import settings
>>> settings.STATIC_ROOT
Path('/edx/var/edxapp/staticfiles/studio')
>>> settings.STATIC_URL
'/static/studio/'
# LMS
>>> from django.conf import settings
>>> settings.STATIC_ROOT
Path('/edx/var/edxapp/staticfiles')
>>> settings.STATIC_URL
'/static/'

I did not change anything, the CMS settings were modified in this commit 3 years ago while the LMS settings in this one 9 years ago.

Are you sure that you are not overriding the settings somewhere? By default, without any modifications, the root directories should be different.