uwsgi 新手,当我运行以下代码时
\n\nfrom time import sleep\nimport threading\nimport os\nimport sys\n\n\ni = 0\n\n\ndef daemon():\n print("pid ", os.getpid())\n global i\n while True:\n i += 1\n print("pid ", os.getpid(), i)\n sleep(3)\n\n\nth = threading.Thread(target=daemon, args=())\nth.start()\n\nprint("application pid ", os.getpid())\n\n\ndef application(environ, start_response):\n start_response(\'200 OK\', [(\'Content-Type\', \'text/html\')])\n return [str(i).encode()]\n\n\ndef atexit(*args):\n import uwsgi\n print(\'At exit called \', uwsgi.worker_id(), os.getpid())\n sys.exit(1)\n\n\ntry:\n import uwsgi\n uwsgi.atexit = atexit\nexcept ImportError:\n pass\nRun Code Online (Sandbox Code Playgroud)\n\n使用命令
\n\nuwsgi --http :9090 --wsgi-file wsgi.py --enable-threads --processes 2\nRun Code Online (Sandbox Code Playgroud)\n\n我得到输出
\n\n*** WARNING: you are running uWSGI without …Run Code Online (Sandbox Code Playgroud)