0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Django + uwsgiで「no python application found, check your startup logs for errors」のエラーが出るとき

Posted at

これ何度かハマってます。。。

今回はDockerコンテナ内のルートディレクトリの階層を動かしてハマりました。

原因なのですが、文字通り「Pythonアプリケーション(DjangoやFlask)が見つからなかったよ」と言っています。
uwsgiってnginxとDjangoを繋ぐものなので、リクエストがNginxまでは行き着いたものの、Djangoまでは行けませんでしたという感じですね。

これの原因は、基本的にはuwsgi.iniにあるようです。

・・・ここまではすぐにわかるんですよね。
問題は、「じゃあuwsgi.iniってどう書くのが正解なんだ??」と調べてみると何やら書き方が多種多様

どれをやれば動くか試行錯誤するしかなく・・・

いまだにどれが正解だかはわかっていません。
が、今回はどうやって解決したかというと
chdirで、mysite_project(Djangoの一番上の階層。その下にmysite_appがあって、その階層の中にsettings.pyなどが入ってる構成です)を指定しました。
ちなみになぜかchdirを絶対pathで書いても動かなかったです。(謎)

↓実際に動いたuwsgi.iniの参考です。

uwsgi.ini
[uwsgi]
chdir=mysite_project
module=mysite_app.wsgi
socket=:8001
py-autoreload=1
daemonize=/etc/uwsgi/log/mysite_app.log
buffer-size=65536
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?