这个问题已经提出了几次,但是每个提供的解决方案似乎都无法解决我的问题。任何人都可以请求帮助,我花了很多时间试图解决问题。
让我分享目录结构和wsgi.py,manage.py代码
目录结构(仅显示下面的必要文件以解释目录结构)
app_pro
.ebextensions
01_packages.config
django.config
setup_packages.sh
.elasticbeanstalk
config.yml
myapp
apps
logs
templates
myapp
__init__.py
settings
production.py
local.py
eb_settings.py
base.py
url.py
wsgi.py
manage.py
manage.py
import os
import sys
settings = "myapp.settings.eb_settings"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings)
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
wsgi.py
import os
import sys
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.eb_settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
django.config
option_settings:
"aws:elasticbeanstalk:application:environment":
DJANGO_SETTINGS_MODULE:
"/opt/python/current/app/app_pro/myapp/myapp/settings/eb_settings"
PYTHONPATH: "/opt/python/current/app/app_pro/myapp:$PYTHONPATH"
"ALLOWED_HOSTS": "*"
"aws:elasticbeanstalk:container:python":
WSGIPath: myapp/myapp/wsgi.py
NumProcesses: 3
NumThreads: 20
"aws:elasticbeanstalk:container:python:staticfiles":
"/static/": "/opt/python/current/app/app_pro/myapp/collectstatic/"
这就是我一直在犯的错误。
Application update failed at 2018-06-01T08:46:59Z with exit status 1 and error: container_command 03_migrate in app_pro/.ebextensions/01_packages.config failed.
myapp.settings.eb_settings
Traceback (most recent call last):
File "/opt/python/ondeck/app/app_pro/myapp/manage.py", line 21, in <module>
execute_from_command_line(sys.argv)
File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
utility.execute()
File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 302, in execute
settings.INSTALLED_APPS
File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 55, in __getattr__
self._setup(name)
File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 43, in _setup
self._wrapped = Settings(settings_module)
File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 99, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: Import by filename is not supported.
可能是问题的根源是什么?