Static File and Media Accessing issue while Deploying Django app in Production Environment

While deploying django app on production environment in openlitespeed server, static files and media files not found. App is woking fine in development environment in local, but after uploading it to server, static content and media files are not accessible.

I have updated my static url as follow:

STATIC_URL = '/public/static/'
STATIC_ROOT = '/home/'

Where app is the project location. I am getting 404 for error for all static and media files:

Failed to load resource: the server responded with a status of 404 ()

When I try collectstatic I am getting following error on terminal:

django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.

I tried many options, none of the options worked. Any solution will be highly appreciated

You’re missing the close-quote on your STATIC_ROOT line (I’ll assume it’s a copy/paste error.)

Does that directory exist? Collectstatic is not going to create it for you.

Yes close-quote was not the problem and yes that directory exists as well.

Problem Solved:

STATIC_ROOT = BASE_DIR / 'app/public/static'

I updated static_root convention according to Django >= 4.0 and on openlitespeed server every static content should be placed inside /public folder which is mandatory rule if we do not edit default configuration. I created /public folder and moved my static and media folder. And then did the collectstatic. Problem resolved.