【发布时间】:2016-03-03 09:53:30
【问题描述】:
我在 python3.4 中尝试了一些烧瓶 在 nginx 后面使用 gunicorn 运行我的应用程序并关闭我的 ssh 会话时遇到了一些问题 使用 ssh 登录后,我运行以下命令:
gunicorn -w 3 -n MultiServer -b 127.0.0.1:8081 app:app &
只要我在我的 ssh 会话中,一切正常。关闭它后,我的网站仍然可以访问,但我点击以下功能:
def get_audio(self, a_link, a_format="mp3"):
a_name = str(self._tmpDownloadDir + "/%(title)s.%(ext)s")
ex = 'youtube-dl -o "'+ a_name +'" --no-playlist --extract-audio --audio-format '+ a_format + ' "' + a_link + '"'
if subprocess.call(ex, shell=True) == 0:
a_name = self._moveAudio()
return (a_link, a_name, a_format)
else:
raise UnsuportedFormatException
我收到内部服务器错误。所有其他网站和功能都正常工作。
这里是完整的代码:
尤其是: YoutubeService
如前所述,只要我使用 ssh 登录,一切都运行良好...而且我还设置了 shell=True。
更新:
好的,我在我的 app.py 中尝试过:
if __name__ == "__main__":
handler = logging.FileHandler('/tmp/app.log')
handler.setLevel(logging.ERROR)
app.logger.addHandler(handler)
app.debug = True
app.run()
但是日志保持为空,没有调试发生
还修复了 gunicorn 日志:
gunicorn --error-logfile /tmp/app1.log -w 3 -n MultiServer -b 127.0.0.1:8081 app:app &
它也是空的,只是一些关于工人的信息开始了。
【问题讨论】:
标签: python-3.x nginx flask gunicorn