systemd uwsgi 服务无法自动运行,但在从交互式会话启动时运行

systemd uwsgi 服务无法自动运行,但在从交互式会话启动时运行

我在systemd中启用了uWSGI服务,但启动时无法运行,日志显示以下内容:

Wed Nov 22 12:36:10 2017 - your processes number limit is 47903
Wed Nov 22 12:36:10 2017 - your memory page size is 4096 bytes
Wed Nov 22 12:36:10 2017 - detected max file descriptor number: 1024
Wed Nov 22 12:36:10 2017 - lock engine: pthread robust mutexes
Wed Nov 22 12:36:10 2017 - thunder lock: disabled (you can enable it with --thunder-lock)
Wed Nov 22 12:36:10 2017 - uwsgi socket 0 bound to UNIX address /run/uwsgi/app/myapp/socket fd 3
Wed Nov 22 12:36:10 2017 - Python version: 2.7.12 (default, Nov 19 2016, 06:48:10)  [GCC 5.4.0 20160609]
Wed Nov 22 12:36:10 2017 - Set PythonHome to /home/me/venv
ImportError: No module named site

但是,当我运行时,sudo systemctl restart uwsgi服务按预期启动:

Wed Nov 22 13:31:07 2017 - setuid() to 1000
Wed Nov 22 13:31:07 2017 - your processes number limit is 47903
Wed Nov 22 13:31:07 2017 - your memory page size is 4096 bytes
Wed Nov 22 13:31:07 2017 - detected max file descriptor number: 1024
Wed Nov 22 13:31:07 2017 - lock engine: pthread robust mutexes
Wed Nov 22 13:31:07 2017 - thunder lock: disabled (you can enable it with --thunder-lock)
Wed Nov 22 13:31:07 2017 - uwsgi socket 0 bound to UNIX address /run/uwsgi/app/myapp/socket fd 3
Wed Nov 22 13:31:07 2017 - Python version: 2.7.12 (default, Nov 19 2016, 06:48:10)  [GCC 5.4.0 20160609]
Wed Nov 22 13:31:07 2017 - Set PythonHome to /home/me/venv
Wed Nov 22 13:31:07 2017 - *** Python threads support is disabled. You can enable it with --enable-threads ***
Wed Nov 22 13:31:07 2017 - Python main interpreter initialized at 0xec83c0
Wed Nov 22 13:31:07 2017 - your server socket listen backlog is limited to 100 connections
Wed Nov 22 13:31:07 2017 - your mercy for graceful operations on workers is 60 seconds
Wed Nov 22 13:31:07 2017 - mapped 218304 bytes (213 KB) for 2 cores
Wed Nov 22 13:31:07 2017 - *** Operational MODE: preforking ***
Wed Nov 22 13:31:09 2017 - WSGI app 0 (mountpoint='') ready in 2 seconds on interpreter 0xec83c0 pid: 2744 (default app)
Wed Nov 22 13:31:09 2017 - *** uWSGI is running in multiple interpreter mode ***
Wed Nov 22 13:31:09 2017 - spawned uWSGI master process (pid: 2744)
Wed Nov 22 13:31:09 2017 - spawned uWSGI worker 1 (pid: 2760, cores: 1)
Wed Nov 22 13:31:09 2017 - spawned uWSGI worker 2 (pid: 2761, cores: 1)

可能是什么问题呢?

相关内容