Just a little note to remind myself and anyone playing around with Django on Coolify: the default Nixpacks for Django will run migrations but not collectstatic
. So if you have problems with your images or CSS not appearing, the quick solution is:
- Install whitenoise
- Set
STATIC_ROOT = BASE_DIR / "staticfiles"
in yoursettings.py
file - Add a
nixpacks.toml
file in your Django base directory that overrides the default run command and adds acollectstatic
step
[start]
cmd = "python manage.py migrate && python manage.py collectstatic --noinput && gunicorn app.wsgi"
Then redeploy and you should have your static files display again.
Leave a Reply