1
私はdjangoプロジェクトのsystemdでgunicornを設定しようとしていますが、プロジェクトの別のライブラリをロードできません。Django + gunicorn + systemdの問題
File "/home/ubuntu/venv/lib/python3.4/importlib/__init__.py", line 109, in import_module
gunicorn[6043]: return _bootstrap._gcd_import(name[level:], package, level)
gunicorn[6043]: ImportError: No module named 'templates'
テンプレートは別のディレクトリにあるプロジェクトの別の部分です。 を私の$PYTHONPATH
に入れずにサイトを実行しようとすると同じエラーが出ます。私はsystemdユニットファイルにpythonpathを追加しましたが、何もしませんでした。
私はでき、このコマンドを使用して、成功した実行gunicorn:
/home/ubuntu/venv/bin/gunicorn --pid /tmp/pid-gunicorn site_gfa.wsgi:application -b 0.0.0.0:8083
しかし、私はsystemdに
にsystemdユニットファイルに失敗した私は、Python 3.4でCentOS7を実行している
[Unit]
Description="Site"
After=network.target
[Service]
PIDFile=/tmp/pid-gunicorn
User=ubuntu
Group=users
Environment=PYTHONPATH='/home/ubuntu/templates/'
WorkingDirectory=/home/ubuntu/gfa-apps/
ExecStart=/home/ubuntu/venv/bin/gunicorn --pid /tmp/pid-gunicorn site_gfa.wsgi:application -b 0.0.0.0:8083
PrivateTmp=true
Type=forking
[Install]
WantedBy=multi-user.target
とガンコン19.4.5 ありがとうございます!