DEV Community

Discussion on: The Right Way to serve static files when using Django with Gunicorn

Collapse
 
prahladyeri profile image
Prahlad Yeri • Edited

Yep, I've read that django docs page and feel that it shows a needlessly confusing and lengthy process. For example, it really makes no sense to have an additional collectstatic process just to copy static files from one folder to other!

$ python manage.py collectstatic
Enter fullscreen mode Exit fullscreen mode

All this does is copy your files from one static folder in your project directory (say "/static/") to another (say "/staticfiles/"). But doing none of that will actually make django serve those static files on production -especially when there is an additional layer like gunicorn. The StackOverflow is filled with these issues. I think django should outright refuse to serve static on production instead of covertly/silently failing in this manner!

Collapse
 
tombohub profile image
tombohub

what do you mean it copies files from one folder to another?

collectstatic collects static files from all the apps in your django project to single one folder.