Django + FastCGI - randomly raising OperationalError

前端 未结 13 1334
忘掉有多难
忘掉有多难 2020-12-31 19:24

I\'m running a Django application. Had it under Apache + mod_python before, and it was all OK. Switched to Lighttpd + FastCGI. Now I randomly get the following exception (ne

13条回答
  •  盖世英雄少女心
    2020-12-31 19:55

    An applicable quote:

    "2019 anyone?" - half of YouTube comments, circa 2019

    If anyone is still dealing with this, make sure your app is "eagerly forking" such that your Python DB driver (psycopg2 for me) isn't sharing resources between processes.

    I solved this issue on uWSGI by adding the lazy-apps = true option, which causes is to fork app processes right out of the gate, rather than waiting for copy-on-write. I imagine other WSGI / FastCGI hosts have similar options.

提交回复
热议问题