python - 解决烧瓶和八度音程的多个问题
问题描述
我正在尝试运行一个烧瓶应用程序,它使用 octave 和 python oct2py 包与 Octave 进行通信。我设置了一个 python venv 并正在运行该应用程序。
简单的烧瓶应用程序似乎工作正常,因为它接受 Post 请求并做出响应。当我尝试添加八度功能时,该应用程序运行良好。使用直接 gunicorn 绑定,该应用程序也可以正常工作。
当我尝试创建systemd service
单元文件并且代码运行八度时,问题就开始了。
我创建了一个类似的服务/etc/systemd/system/my_project.service
,它的内容如下。
[Unit]
Description=Gunicorn instance to serve flask app
After=network.target
[Service]
User=some_user
Group=www-data
WorkingDirectory=/home/some_user/project_dir
Environment="PATH=/home/some_user/project_dir/venv/bin"
ExecStart=/home/some_user/project_dir/venv/bin/gunicorn --workers 3 --bind unix:project_dir.sock -m 007 wsgi:app
[Install]
WantedBy=multi-user.target
查看状态后,它会引发错误,例如
重新启动服务后它抛出
gunicorn[1690]: self.restart()
gunicorn[1690]: File "/home/some_user/project_dir/venv/lib/python3.8/site-packages/oc>
gunicorn[1690]: self._engine = OctaveEngine(stdin_handler=self._handle_stdin,
gunicorn[1690]: File "/home/some_user/project_dir/venv/lib/python3.8/site-packages/oc>
gunicorn[1690]: self.executable = self._get_executable()
gunicorn[1690]: File "/home/some_user/project_dir/venv/lib/python3.8/site-packages/oc>
gunicorn[1690]: raise OSError('octave-cli not found, please see README')
gunicorn[1690]: OSError: octave-cli not found, please see README
systemd[1]: my_project.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: my_project.service: Failed with result 'exit-code'.
对于 octave,我尝试在有和没有 venv 活动的情况下从终端运行 octave 和 octave-cli,它会打开 octave,所以我无法找出确切的原因。
如果我直接在终端上运行命令,它将运行应用程序而不会出现任何错误
gunicorn --bind 127.1.0.1:5000 wsgi:app
wsgi.py 文件看起来像这样
from my_project import app
if __name__ == "__main__":
app.run()
任何建议如何解决这个问题?
解决方案
推荐阅读
- python - django loaddata 上的错误(1062,“密钥 'user_id' 的重复条目 '4'”)
- python - 仅替换一个字符的一个实例,而不是每次出现
- python - 为什么有些颜色透明后不能恢复原色
- spring - Spring - 如何在类中注释属性
- python - 为什么 TensorFlow 分类示例不使用激活函数?
- reactjs - 您已多次调用 Google Maps API
- ruby-on-rails - 带有动态参数的 rails 4 中不允许的参数
- python - 我无法在 atom 文本编辑器中安装 autocomplete-python 包
- javascript - 在我的班级中实现添加和删除功能
- dialogflow-es - UNLINK OR RELINK - Google 助理帐号关联流程