set django static root
In the settings.py file of your Django project, first import the os module using the following line of code:
import os
Then, define the base directory of your project using the following line:
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
After that, define the STATIC_ROOT variable and set its value to the directory where you want to collect all your static files using the following line:
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
Finally, make sure you have run the
python manage.py collectstatic
command to gather all your static files into the specified directory.