I managed to run my Django projects on a Hetzner Managed Server with FastCGI following this tutorial, see also this post).
However, static files do not work. For easier testing, I created a brand new django project and added the following to the settings.py
as described in the docs:
STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = "static/"
I already ran python manage.py collectstatic
and files like staticfiles/admin/css/base.css
were created. However, when I access these static files via browser, I get a 404 error.
It makes no difference if DJANGO
is set to False
or True
. After each edit of settings.py
, I killed all running fcgi
processes to force a reload.
I am aware that Django’s build in FastCGI support has dropped long time ago, but as far as I understand, it should still work when properly configured by hand. And for small projects, it’s still OK to use it, right?
So I would be very thankful for any help.
Currently, I am using Python 3.11.2 and Django 5.1.7.