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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…