gunicorn not serving static files

老子叫甜甜 提交于 2019-12-05 10:39:13

Gunicorn is not a general-purpose web server, all it does is serve an application (django in this case). And django does not serve static files except in development, for the convenience of the developer, because it is not an efficient or necessarily secure vehicle for serving static files.

If you follow the instructions all the way through you will be directed to set up nginx running on port 80, which will 1) proxy your application from port 8000 to port 80 and 2) serve static files on the same port, choosing which to do per request based on the URL.

It is not cause for alarm that static files do not work on port 8000 -- under this configuration they should only work on port 80, once nginx is properly configured. There are other possible configurations for django with other strategies for serving static files, although most of them follow the recommended convention of serving static files totally separate from the application like in this case.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!