nginx+uwsgi+django, there seems to be some strange cache in uwsgi, help me

泄露秘密 提交于 2019-12-05 18:47:40
  • uwsgi does not reload your code automatically, only development server does
  • runserver is for debug purposes, uwsgi and nginx for production
  • in production you can restart uwsgi by service uwsgi restart or via init.d script
  • there is even better way to reload uwsg by using touch-reload

usually there is no need to cleanup .pyc files, it happens only when timestamps on files are wrong (I've seen it only couple times at my entire carieer)

This is normal behavior. uwsgi will not re-read your code unless you restart it (it does not work like runserver when you have DEBUG=True).

If after you have updated your code, restarted uwsgi, cleared your browser cache and it still doesn't reflect your changes, then you should delete *.pyc files from your source directory.

I typically use this:

find . -name "*.pyc" -exec rm {} \;

Roughly speaking, .pyc is the "compiled" version of your code. Python will load this optimized version if it doesn't detect a change in the source. If you delete these files; then it will re-read your source files.

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