Static Files not loading when DEBUG = False

I have set

DEBUG = False

and

STATIC_URL = '/static/'
STATICFILES_DIRS = [
    BASE_DIR / "static",
]
STATIC_ROOT = "static_root"

The static files aren’t loading. I want to use the same server for serving static files and not an external one.

Thank you for your time!

What server are you using?

Uh, I’m running it on localhost with debug false and I ran it on GoDaddy hosting also, sam e result- None of the static files are being explained.

Yes, I understand that. What server are you using to run your system? Apache, nginx, gunicorn, uwsgi, what?

I’m watching how to deploy from this video: https://youtu.be/kBwhtEIXGII
He created a Procfile for Heroku and has web: gunicorn project.wsgi --log-file -
I don’t know what I need to do for running it on local host and then on GoDaddy hosting.

Uh, I got it working… I installed gunicorn and whitenoise like I did for Heroku and then I added whitenoise middleware and it started working???

Whitenoise allows your python app to serve the static files. The documentation likely explains it better.

could you solve it? I have the same problem, I’m using railway with unicorn