在向aws部署django应用程序时,我收到500内部服务器错误。我在活动日志中找不到任何错误。创建了环境并且应用程序已成功部署,但是当我尝试运行它时它显示此错误。有人可以帮我解决这个问题吗? 我添加了错误日志的文本和图像。感谢。
-------------------------------------
/var/log/httpd/error_log
-------------------------------------
[Mon May 28 14:23:48.433306 2018] [:error] [pid 4775] [remote 172.31.30.246:204] return _bootstrap._gcd_import(name[level:], package, level)
[Mon May 28 14:23:48.433311 2018] [:error] [pid 4775] [remote 172.31.30.246:204] File "<frozen importlib._bootstrap>", line 994, in _gcd_import
[Mon May 28 14:23:48.433316 2018] [:error] [pid 4775] [remote 172.31.30.246:204] File "<frozen importlib._bootstrap>", line 971, in _find_and_load
[Mon May 28 14:23:48.433321 2018] [:error] [pid 4775] [remote 172.31.30.246:204] File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
[Mon May 28 14:23:48.433325 2018] [:error] [pid 4775] [remote 172.31.30.246:204] File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
[Mon May 28 14:23:48.433330 2018] [:error] [pid 4775] [remote 172.31.30.246:204] File "<frozen importlib._bootstrap_external>", line 674, in exec_module
[Mon May 28 14:23:48.433335 2018] [:error] [pid 4775] [remote 172.31.30.246:204] File "<frozen importlib._bootstrap_external>", line 781, in get_code
[Mon May 28 14:23:48.433339 2018] [:error] [pid 4775] [remote 172.31.30.246:204] File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
[Mon May 28 14:23:48.433344 2018] [:error] [pid 4775] [remote 172.31.30.246:204] File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
[Mon May 28 14:23:48.433357 2018] [:error] [pid 4775] [remote 172.31.30.246:204] File "/opt/python/current/app/totaliQ/settings.py", line 29
[Mon May 28 14:23:48.433364 2018] [:error] [pid 4775] [remote 172.31.30.246:204] ALLOWED_HOSTS = [vir-env1.kkhhumhvum.us-west-2.elasticbeanstalk.com]
[Mon May 28 14:23:48.433392 2018] [:error] [pid 4775] [remote 172.31.30.246:204] ^
[Mon May 28 14:23:48.433399 2018] [:error] [pid 4775] [remote 172.31.30.246:204] SyntaxError: invalid syntax
[Mon May 28 14:23:54.617673 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] mod_wsgi (pid=4775): Target WSGI script '/opt/python/current/app/totaliQ/wsgi.py' cannot be loaded as Python module.
[Mon May 28 14:23:54.617721 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] mod_wsgi (pid=4775): Exception occurred processing WSGI script '/opt/python/current/app/totaliQ/wsgi.py'.
[Mon May 28 14:23:54.617965 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] Traceback (most recent call last):
[Mon May 28 14:23:54.618019 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] File "/opt/python/current/app/totaliQ/wsgi.py", line 16, in <module>
[Mon May 28 14:23:54.618023 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] application = get_wsgi_application()
[Mon May 28 14:23:54.618029 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Mon May 28 14:23:54.618033 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] django.setup(set_prefix=False)
[Mon May 28 14:23:54.618038 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/__init__.py", line 19, in setup
[Mon May 28 14:23:54.618041 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Mon May 28 14:23:54.618046 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/conf/__init__.py", line 56, in __getattr__
[Mon May 28 14:23:54.618049 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] self._setup(name)
[Mon May 28 14:23:54.618054 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/conf/__init__.py", line 43, in _setup
[Mon May 28 14:23:54.618066 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] self._wrapped = Settings(settings_module)
[Mon May 28 14:23:54.618071 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/conf/__init__.py", line 106, in __init__
[Mon May 28 14:23:54.618075 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] mod = importlib.import_module(self.SETTINGS_MODULE)
[Mon May 28 14:23:54.618079 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] File "/opt/python/run/venv/lib64/python3.6/importlib/__init__.py", line 126, in import_module
[Mon May 28 14:23:54.618082 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] return _bootstrap._gcd_import(name[level:], package, level)
[Mon May 28 14:23:54.618087 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] File "<frozen importlib._bootstrap>", line 994, in _gcd_import
[Mon May 28 14:23:54.618092 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] File "<frozen importlib._bootstrap>", line 971, in _find_and_load
[Mon May 28 14:23:54.618097 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
[Mon May 28 14:23:54.618102 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
[Mon May 28 14:23:54.618107 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] File "<frozen importlib._bootstrap_external>", line 674, in exec_module
[Mon May 28 14:23:54.618111 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] File "<frozen importlib._bootstrap_external>", line 781, in get_code
[Mon May 28 14:23:54.618116 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
[Mon May 28 14:23:54.618121 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
[Mon May 28 14:23:54.618146 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] File "/opt/python/current/app/totaliQ/settings.py", line 29
[Mon May 28 14:23:54.618154 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] ALLOWED_HOSTS = [vir-env1.kkhhumhvum.us-west-2.elasticbeanstalk.com]
[Mon May 28 14:23:54.618206 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] ^
[Mon May 28 14:23:54.618213 2018] [:error] [pid 4775] [remote 172.31.30.246:15820] SyntaxError: invalid syntax
[Mon May 28 14:24:00.753060 2018] [:error] [pid 4775] [remote 172.31.30.246:200] mod_wsgi (pid=4775): Target WSGI script '/opt/python/current/app/totaliQ/wsgi.py' cannot be loaded as Python module.
[Mon May 28 14:24:00.753109 2018] [:error] [pid 4775] [remote 172.31.30.246:200] mod_wsgi (pid=4775): Exception occurred processing WSGI script '/opt/python/current/app/totaliQ/wsgi.py'.
[Mon May 28 14:24:00.753272 2018] [:error] [pid 4775] [remote 172.31.30.246:200] Traceback (most recent call last):
[Mon May 28 14:24:00.753323 2018] [:error] [pid 4775] [remote 172.31.30.246:200] File "/opt/python/current/app/totaliQ/wsgi.py", line 16, in <module>
-------------------------------------
/var/log/eb-activity.log
-------------------------------------
inflating: /opt/python/ondeck/app/vir-env/Scripts/pip.exe
inflating: /opt/python/ondeck/app/vir-env/Scripts/pip3.6.exe
inflating: /opt/python/ondeck/app/vir-env/Scripts/pip3.exe
inflating: /opt/python/ondeck/app/vir-env/Scripts/pyexpat.pyd
inflating: /opt/python/ondeck/app/vir-env/Scripts/python.exe
inflating: /opt/python/ondeck/app/vir-env/Scripts/python3.dll
inflating: /opt/python/ondeck/app/vir-env/Scripts/python36.dll
inflating: /opt/python/ondeck/app/vir-env/Scripts/pythonw.exe
inflating: /opt/python/ondeck/app/vir-env/Scripts/select.pyd
inflating: /opt/python/ondeck/app/vir-env/Scripts/sqlite3.dll
inflating: /opt/python/ondeck/app/vir-env/Scripts/tcl86t.dll
inflating: /opt/python/ondeck/app/vir-env/Scripts/tk86t.dll
inflating: /opt/python/ondeck/app/vir-env/Scripts/ucrtbase.dll
inflating: /opt/python/ondeck/app/vir-env/Scripts/unicodedata.pyd
inflating: /opt/python/ondeck/app/vir-env/Scripts/vccorlib140.dll
inflating: /opt/python/ondeck/app/vir-env/Scripts/vcomp140.dll
inflating: /opt/python/ondeck/app/vir-env/Scripts/vcruntime140.dll
inflating: /opt/python/ondeck/app/vir-env/Scripts/winsound.pyd
inflating: /opt/python/ondeck/app/vir-env/Scripts/xlwings32-0.11.5.dll
inflating: /opt/python/ondeck/app/vir-env/Scripts/xlwings64-0.11.5.dll
extracting: /opt/python/ondeck/app/vir-env/pip-selfcheck.json
inflating: /opt/python/ondeck/app/vir-env/pyvenv.cfg
[2018-05-28T14:23:07.865Z] INFO [4604] - [Application update app-29a6-180528_115229@4/AppDeployStage0/AppDeployPreHook/03deploy.py] : Starting activity...
[2018-05-28T14:23:08.526Z] INFO [4604] - [Application update app-29a6-180528_115229@4/AppDeployStage0/AppDeployPreHook/03deploy.py] : Completed activity. Result:
Requirement already satisfied: Django==2.0.5 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 1))
Requirement already satisfied: django-appconf==1.0.2 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 2))
Requirement already satisfied: django-bootstrap3==10.0.1 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 3))
Requirement already satisfied: django-multiselectfield==0.1.8 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 4))
Requirement already satisfied: django-rest-framework==0.1.0 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 5))
Requirement already satisfied: django-select2==6.0.2 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 6))
Requirement already satisfied: djangorestframework==3.8.2 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 7))
Requirement already satisfied: pytz==2018.4 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 8))
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[2018-05-28T14:23:08.526Z] INFO [4604] - [Application update app-29a6-180528_115229@4/AppDeployStage0/AppDeployPreHook/04configen.py] : Starting activity...
[2018-05-28T14:23:09.919Z] INFO [4604] - [Application update app-29a6-180528_115229@4/AppDeployStage0/AppDeployPreHook/04configen.py] : Completed activity.
[2018-05-28T14:23:09.919Z] INFO [4604] - [Application update app-29a6-180528_115229@4/AppDeployStage0/AppDeployPreHook] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/pre.
[2018-05-28T14:23:09.919Z] INFO [4604] - [Application update app-29a6-180528_115229@4/AppDeployStage0/EbExtensionPostBuild] : Starting activity...
[2018-05-28T14:23:10.310Z] INFO [4604] - [Application update app-29a6-180528_115229@4/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild] : Starting activity...
[2018-05-28T14:23:10.310Z] INFO [4604] - [Application update app-29a6-180528_115229@4/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild] : Completed activity.
[2018-05-28T14:23:10.325Z] INFO [4604] - [Application update app-29a6-180528_115229@4/AppDeployStage0/EbExtensionPostBuild] : Completed activity.
[2018-05-28T14:23:10.325Z] INFO [4604] - [Application update app-29a6-180528_115229@4/AppDeployStage0/InfraCleanEbextension] : Starting activity...
[2018-05-28T14:23:10.358Z] INFO [4604] - [Application update app-29a6-180528_115229@4/AppDeployStage0/InfraCleanEbextension] : Completed activity.
Result:
Cleaned ebextensions subdirectories from /opt/python/ondeck/app.
[2018-05-28T14:23:10.358Z] INFO [4604] - [Application update app-29a6-180528_115229@4/AppDeployStage0] : Completed activity. Result:
Application update - Command CMD-AppDeploy stage 0 completed
[2018-05-28T14:23:10.359Z] INFO [4604] - [Application update app-29a6-180528_115229@4/AppDeployStage1] : Starting activity...
[2018-05-28T14:23:10.359Z] INFO [4604] - [Application update app-29a6-180528_115229@4/AppDeployStage1/AppDeployEnactHook] : Starting activity...
答案 0 :(得分:1)
回溯指向行中的无效语法:
ALLOWED_HOSTS = [vir-env1.kkhhumhvum.us-west-2.elasticbeanstalk.com]
主机是字符串,因此应该在引号中:
ALLOWED_HOSTS = ['vir-env1.kkhhumhvum.us-west-2.elasticbeanstalk.com']