Reputation: 5793
I am trying to upgrade a Django application from AWS Elastic Beans Python 3.6 running on 64bit Amazon Linux/2.9.20 to Python 3.8 running on 64bit Amazon Linux 2/3.2.0. It runs locally. When I try and deploy to Elastic Beanstalk I'm getting the following error:
Apr 6 10:30:48 ip-172-31-43-9 web: File "/var/app/current/src/core/wsgi.py", line 14, in <module>
Apr 6 10:30:48 ip-172-31-43-9 web: application = get_wsgi_application()
Apr 6 10:30:48 ip-172-31-43-9 web: File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
Apr 6 10:30:48 ip-172-31-43-9 web: django.setup(set_prefix=False)
Apr 6 10:30:48 ip-172-31-43-9 web: File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/__init__.py", line 19, in setup
Apr 6 10:30:48 ip-172-31-43-9 web: configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
Apr 6 10:30:48 ip-172-31-43-9 web: File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/conf/__init__.py", line 82, in __getattr__
Apr 6 10:30:48 ip-172-31-43-9 web: self._setup(name)
Apr 6 10:30:48 ip-172-31-43-9 web: File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/conf/__init__.py", line 69, in _setup
Apr 6 10:30:48 ip-172-31-43-9 web: self._wrapped = Settings(settings_module)
Apr 6 10:30:48 ip-172-31-43-9 web: File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/conf/__init__.py", line 170, in __init__
Apr 6 10:30:48 ip-172-31-43-9 web: mod = importlib.import_module(self.SETTINGS_MODULE)
Apr 6 10:30:48 ip-172-31-43-9 web: File "/usr/lib64/python3.8/importlib/__init__.py", line 127, in import_module
Apr 6 10:30:48 ip-172-31-43-9 web: return _bootstrap._gcd_import(name[level:], package, level)
Apr 6 10:30:48 ip-172-31-43-9 web: File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
Apr 6 10:30:48 ip-172-31-43-9 web: File "<frozen importlib._bootstrap>", line 991, in _find_and_load
Apr 6 10:30:48 ip-172-31-43-9 web: File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
Apr 6 10:30:48 ip-172-31-43-9 web: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
Apr 6 10:30:48 ip-172-31-43-9 web: File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
Apr 6 10:30:48 ip-172-31-43-9 web: File "<frozen importlib._bootstrap>", line 991, in _find_and_load
Apr 6 10:30:48 ip-172-31-43-9 web: File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
Apr 6 10:30:48 ip-172-31-43-9 web: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
Apr 6 10:30:48 ip-172-31-43-9 web: File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
Apr 6 10:30:48 ip-172-31-43-9 web: File "<frozen importlib._bootstrap>", line 991, in _find_and_load
Apr 6 10:30:48 ip-172-31-43-9 web: File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
Apr 6 10:30:48 ip-172-31-43-9 web: ModuleNotFoundError: No module named 'core'
My file structure is:
.ebextensions
01_packages.config
...
.platform/hooks/postdeploy
01_django.sh
src
app1
app2
...
core
folder 1
...
settings
base.py
local.py
aws.py
celery.py
...
wsgi.py
...
core
is in the INSTALLED_APPS
. Please help
Upvotes: 2
Views: 448
Reputation: 5793
In anticipation of a better solution, my temporary solution is to move my .ebextensions
, .elasticbeanstalk
and .platform
directories down 1 level.
It looks like this
src
.ebextensions
01_packages.config
...
.platform/hooks/postdeploy
01_django.sh
app1
app2
...
core
folder 1
...
settings
base.py
local.py
aws.py
celery.py
...
wsgi.py
...
I do my git push
to save to GitHub from the previous main directory and then move into src
to performeb deploy
. I'm not happy with the solution and consider it a workaround until someone can give me something better
Upvotes: 1