Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
525 views
in Technique[技术] by (71.8m points)

amazon web services - AWS EB Django ModuleNotFoundError: No module named 'my_project'

I am trying to deploy a django webapp into AWS EB. The app works fine in the localhost but when I try to deploy it, I keep getting ModuleNotFoundError: No module named 'my_project'.

File "/usr/lib64/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'my_project'

django.config

option_settings:
 aws:elasticbeanstalk:container:python:
    WSGIPath: myapp.wsgi:application

packages:
  yum:
    mod_ssl: []

wsgi.py

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myapp.settings')

application = get_wsgi_application()

My local directory looks like this:

my_project
├── .ebextensions
├── myapp
│   ├── settings.py
│   └── wsgi.py
├── manage.py
├── requirement.txt
.
.
.

I am using Amazon Linux 2 with the Python environment. How can I make it work?

question from:https://stackoverflow.com/questions/65925956/aws-eb-django-modulenotfounderror-no-module-named-my-project

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...