简体   繁体   English

如何在接收后使用git hooks在远程服务器上运行Flask App?

[英]How do I run a Flask App on a remote server with git hooks post-receive?

I added a post-receive git hook on the server side so that a flask app runs after the receive. 我在服务器端添加了一个后接收git钩子,以便烧瓶应用程序在接收后运行。 The script works and the app runs on the server. 该脚本有效,该应用程序在服务器上运行。 However, from the client side, when pushing, the process gets stuck at even when the flask app is already running on the server. 但是,从客户端进行推送时,即使Flask应用程序已经在服务器上运行,该过程也会陷入困境。

Pushing to root@192.168.XX.XX:~/api/

Here is the post-receive script. 这是接收后脚本。

#!/bin/sh

# Post-receive hook to make the API
# run back up again after the changes are made.
python3 ../../api_run.py &

exit 0

Here's what I did to solve this problem. 这是我为解决此问题所做的工作。

Instead of the previous command, I added some few more to silence the terminal output. 代替上一个命令,我添加了一些其他命令以使终端输出静音。

python3 ../../api_run.py > /dev/null 2>&1 &

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM