Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 瓶子错误“;处理请求时出现严重错误:“0”;当从systemd启动时_Python 3.x_Systemd_Bottle - Fatal编程技术网

Python 3.x 瓶子错误“;处理请求时出现严重错误:“0”;当从systemd启动时

Python 3.x 瓶子错误“;处理请求时出现严重错误:“0”;当从systemd启动时,python-3.x,systemd,bottle,Python 3.x,Systemd,Bottle,我有一个构建在瓶子上的服务器,从userland启动时工作得很好。服务器显示在端口8088上,似乎正在与外部世界通信,但当我联系应用程序时,我得到的只是一个信息非常丰富的“处理请求时出现严重错误:模式”,这是应用程序的url。 我的systemd文件如下: [Unit] Description=Survey Service After=multi-user.target Conflicts=getty@tty1.service [Service] User=ubuntu Type=simple

我有一个构建在瓶子上的服务器,从userland启动时工作得很好。服务器显示在端口8088上,似乎正在与外部世界通信,但当我联系应用程序时,我得到的只是一个信息非常丰富的“处理请求时出现严重错误:模式”,这是应用程序的url。 我的systemd文件如下:

[Unit]
Description=Survey Service
After=multi-user.target
Conflicts=getty@tty1.service

[Service]
User=ubuntu
Type=simple
Working-directory=/home/ubuntu/survey
ExecStart=/usr/bin/python3 /home/ubuntu/survey/server.py

[Install]
WantedBy=multi-user.target
我发现了几篇与信息性错误消息相关的文章,但没有一篇与systemd相关。正如我所说,当使用非常简单的命令“python3server.py”在项目目录中以用户ubuntu的身份启动时,该应用程序运行得非常完美,但似乎没有。。。当systemd试图启动它时,会出现一些问题


Systemd报告进程正在运行,正如我所说,我能够连接到应用程序。。。它只是以一种有序的方式失败了,我不知道为什么。我怀疑是权限问题,但“用户”和“工作目录”不解决这个问题吗?应用程序使用的所有文件都位于该目录或其下的目录中

显然是用老办法:将systemd设置为运行bash脚本:

cat/home/ubuntu/survey/server.sh

#!/bin/bash
cd /home/ubuntu/survey/
python3 server.py

很好用。因此,我的问题现在变成了关于systemd的问题:如果“工作目录”实际上没有设置为该工作目录,那么“工作目录”有什么意义呢?

显然,按照旧的方式进行操作:将systemd设置为运行bash脚本:

cat/home/ubuntu/survey/server.sh

#!/bin/bash
cd /home/ubuntu/survey/
python3 server.py
很好用。所以我现在的问题是关于systemd的:如果“工作目录”实际上没有设置为该工作目录,那么“工作目录”有什么意义