擅长:python、mysql、java
<p>在跟随Michal Karzynski的伟大指南<a href="http://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/" rel="noreferrer">Setting up Django with Nginx, Gunicorn, virtualenv, supervisor and PostgreSQL</a>之后,我遇到了同样的问题。</p>
<p>我就是这样解决的。</p>
<p>bash脚本中有一个变量,用于通过Supervisor(myapp/bin/gunicorn_start)启动gunicorn:</p>
<pre><code>SOCKFILE={{ myapp absolute path }}/run/gunicorn.sock
</code></pre>
<p>当您第一次运行bash脚本时,它会使用根特权创建一个“run”文件夹和一个sock文件<em>。所以我sudo删除了run文件夹,然后重新创建了它,没有sudo权限和voila!现在,如果您重新运行Gunicorn或Supervisor,您将不再有恼人的丢失sock文件错误消息!</p>
<p><strong>TL;DR</strong></p>
<ol>
<li>Sudo删除运行文件夹。</li>
<li>在没有sudo权限的情况下重新创建它。</li>
<li>再次运行Gunicorn。</li>
<li>????</li>
<li>利润</li>
</ol>