import os if __name__ == "__main__": # Run the Flask app using Gunicorn in the background with nohup command = "nohup gunicorn -w 4 -b 0.0.0.0:7860 myapp:myapp > gunicorn_output.log 2>&1 &" os.system(command)