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.

uWSGI と Nginx 使ってて"No module named 'myproject' " が出てきたお話

Last updated at Posted at 2021-02-28

概要

AWSのEC2にてDjango + Nginx + uWSGIと言う構成でデプロイしようとしていた。

Nginxの設定とかも終えて、

$ uwsgi --socket :8001 --module myproject.wsgi

と打ち込んで行けるかなと思っていたところ、下記のエラーが出た。

ModuleNotFoundError: No module named 'myproject'

原因を調べていると、少なからず同じ境遇で困っている人がいたので解決法を見ていたのだが、
各自、違う理由で件のエラーが起きており、違う解決法で対処していた。

なので、手探りで解決の糸口を探していた。

解決法

$ python3 manage.py collectstatic

なんと、コレクトスタティックしただけですんなり行けた。

ちゃんとuWSGIが動いていることも確認できたし、何よりURLにアクセスできた。

備考

もう少し、エラーの内容をわかりやすく吐き出して欲しいなと思った。(ログ吐く場所があるらしいからそこ見なさいって話だが)

[2021/2/28 22:17 追記]
プロジェクトルートがカレントディレクトリじゃないと上手く動かないかもしれないことを発見。

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?