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)

可能是什麼問題呢?

相關內容