Python AWS Beanstalk中的Django应用程序部署-部署后出错-内部服务器错误

Python AWS Beanstalk中的Django应用程序部署-部署后出错-内部服务器错误,python,django,amazon-web-services,amazon-elastic-beanstalk,web-deployment,Python,Django,Amazon Web Services,Amazon Elastic Beanstalk,Web Deployment,我在AWS beanstalk上部署了一个django应用程序。在遵循官方文件之后,第一版还可以: 然后,我使用django过滤器向我的站点添加了一个新特性。现在,在部署时,在主前端页面上出现以下错误: 内部服务器错误 服务器遇到内部错误或配置错误,无法完成您的请求 请通过以下地址与服务器管理员联系:root@localhost通知他们此错误发生的时间,以及您在此错误之前执行的操作。 有关此错误的详细信息,请参阅服务器错误日志 下面是我的错误日志 [Thu Oct 01 04:47:09.118

我在AWS beanstalk上部署了一个django应用程序。在遵循官方文件之后,第一版还可以:

然后,我使用django过滤器向我的站点添加了一个新特性。现在,在部署时,在主前端页面上出现以下错误:

内部服务器错误

服务器遇到内部错误或配置错误,无法完成您的请求

请通过以下地址与服务器管理员联系:root@localhost通知他们此错误发生的时间,以及您在此错误之前执行的操作。 有关此错误的详细信息,请参阅服务器错误日志

下面是我的错误日志

[Thu Oct 01 04:47:09.118698 2020] [:error] [pid 21279] [remote 172.31.47.200:20528]     apps.populate(settings.INSTALLED_APPS)
[Thu Oct 01 04:47:09.118704 2020] [:error] [pid 21279] [remote 172.31.47.200:20528]   File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/apps/registry.py", line 83, in populate
[Thu Oct 01 04:47:09.118707 2020] [:error] [pid 21279] [remote 172.31.47.200:20528]     raise RuntimeError("populate() isn't reentrant")
[Thu Oct 01 04:47:09.118722 2020] [:error] [pid 21279] [remote 172.31.47.200:20528] RuntimeError: populate() isn't reentrant
[Thu Oct 01 04:47:13.477606 2020] [:error] [pid 21279] [remote 172.31.3.100:48] mod_wsgi (pid=21279): Target WSGI script '/opt/python/current/app/djangoproject/wsgi.py' cannot be loaded as Python module.
[Thu Oct 01 04:47:13.477658 2020] [:error] [pid 21279] [remote 172.31.3.100:48] mod_wsgi (pid=21279): Exception occurred processing WSGI script '/opt/python/current/app/djangoproject/wsgi.py'.
[Thu Oct 01 04:47:13.477768 2020] [:error] [pid 21279] [remote 172.31.3.100:48] Traceback (most recent call last):
[Thu Oct 01 04:47:13.477801 2020] [:error] [pid 21279] [remote 172.31.3.100:48]   File "/opt/python/current/app/djangoproject/wsgi.py", line 16, in <module>
[Thu Oct 01 04:47:13.477806 2020] [:error] [pid 21279] [remote 172.31.3.100:48]     application = get_wsgi_application()
[Thu Oct 01 04:47:13.477812 2020] [:error] [pid 21279] [remote 172.31.3.100:48]   File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Thu Oct 01 04:47:13.477816 2020] [:error] [pid 21279] [remote 172.31.3.100:48]     django.setup(set_prefix=False)
[Thu Oct 01 04:47:13.477822 2020] [:error] [pid 21279] [remote 172.31.3.100:48]   File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
[Thu Oct 01 04:47:13.477825 2020] [:error] [pid 21279] [remote 172.31.3.100:48]     apps.populate(settings.INSTALLED_APPS)
[Thu Oct 01 04:47:13.477831 2020] [:error] [pid 21279] [remote 172.31.3.100:48]   File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/apps/registry.py", line 83, in populate
[Thu Oct 01 04:47:13.477834 2020] [:error] [pid 21279] [remote 172.31.3.100:48]     raise RuntimeError("populate() isn't reentrant")
[Thu Oct 01 04:47:13.477849 2020] [:error] [pid 21279] [remote 172.31.3.100:48] RuntimeError: populate() isn't reentrant
[Thu Oct 01 04:47:17.516356 2020] [:error] [pid 21279] [remote 172.31.29.143:48] mod_wsgi (pid=21279): Target WSGI script '/opt/python/current/app/djangoproject/wsgi.py' cannot be loaded as Python module.
[Thu Oct 01 04:47:17.516412 2020] [:error] [pid 21279] [remote 172.31.29.143:48] mod_wsgi (pid=21279): Exception occurred processing WSGI script '/opt/python/current/app/djangoproject/wsgi.py'.
[Thu Oct 01 04:47:17.516522 2020] [:error] [pid 21279] [remote 172.31.29.143:48] Traceback (most recent call last):
[Thu Oct 01 04:47:17.516557 2020] [:error] [pid 21279] [remote 172.31.29.143:48]   File "/opt/python/current/app/djangoproject/wsgi.py", line 16, in <module>
[Thu Oct 01 04:47:17.516562 2020] [:error] [pid 21279] [remote 172.31.29.143:48]     application = get_wsgi_application()
[Thu Oct 01 04:47:17.516568 2020] [:error] [pid 21279] [remote 172.31.29.143:48]   File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Thu Oct 01 04:47:17.516572 2020] [:error] [pid 21279] [remote 172.31.29.143:48]     django.setup(set_prefix=False)
[Thu Oct 01 04:47:17.516577 2020] [:error] [pid 21279] [remote 172.31.29.143:48]   File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
[Thu Oct 01 04:47:17.516589 2020] [:error] [pid 21279] [remote 172.31.29.143:48]     apps.populate(settings.INSTALLED_APPS)
[Thu Oct 01 04:47:17.516596 2020] [:error] [pid 21279] [remote 172.31.29.143:48]   File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/apps/registry.py", line 83, in populate
[Thu Oct 01 04:47:17.516599 2020] [:error] [pid 21279] [remote 172.31.29.143:48]     raise RuntimeError("populate() isn't reentrant")
[Thu Oct 01 04:47:17.516615 2020] [:error] [pid 21279] [remote 172.31.29.143:48] RuntimeError: populate() isn't reentrant
[Thu Oct 01 04:47:18.842837 2020] [:error] [pid 21279] [remote 172.31.58.190:44] mod_wsgi (pid=21279): Target WSGI script '/opt/python/current/app/djangoproject/wsgi.py' cannot be loaded as Python module.
[Thu Oct 01 04:47:18.842888 2020] [:error] [pid 21279] [remote 172.31.58.190:44] mod_wsgi (pid=21279): Exception occurred processing WSGI script '/opt/python/current/app/djangoproject/wsgi.py'.
[Thu Oct 01 04:47:18.843064 2020] [:error] [pid 21279] [remote 172.31.58.190:44] Traceback (most recent call last):
[Thu Oct 01 04:47:18.843099 2020] [:error] [pid 21279] [remote 172.31.58.190:44]   File "/opt/python/current/app/djangoproject/wsgi.py", line 16, in <module>
[Thu Oct 01 04:47:18.843103 2020] [:error] [pid 21279] [remote 172.31.58.190:44]     application = get_wsgi_application()
[Thu Oct 01 04:47:18.843110 2020] [:error] [pid 21279] [remote 172.31.58.190:44]   File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Thu Oct 01 04:47:18.843113 2020] [:error] [pid 21279] [remote 172.31.58.190:44]     django.setup(set_prefix=False)
[Thu Oct 01 04:47:18.843119 2020] [:error] [pid 21279] [remote 172.31.58.190:44]   File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
[Thu Oct 01 04:47:18.843123 2020] [:error] [pid 21279] [remote 172.31.58.190:44]     apps.populate(settings.INSTALLED_APPS)
[Thu Oct 01 04:47:18.843129 2020] [:error] [pid 21279] [remote 172.31.58.190:44]   File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/apps/registry.py", line 83, in populate
[Thu Oct 01 04:47:18.843132 2020] [:error] [pid 21279] [remote 172.31.58.190:44]     raise RuntimeError("populate() isn't reentrant")
[Thu Oct 01 04:47:18.843147 2020] [:error] [pid 21279] [remote 172.31.58.190:44] RuntimeError: populate() isn't reentrant ```
WSGI文件:

option_settings:
  aws:elasticbeanstalk:container:python:
    WSGIPath: djangoproject/wsgi.py

你能帮忙吗。我已经尝试解决这个问题一段时间了

非常感谢你,
Cj

.ebextensions
django配置文件中执行此操作:

command: "source /var/app/venv/staging-LQM1lest/bin/activate && pip install -r requirements/production.txt"
因此,基本上激活venv并运行pip安装,以确保依赖项安装在正确的venv中。此外:

aws:elasticbeanstalk:container:python:
 WSGIPath: config.wsgi:application

在我的例子中,我在根目录中有一个config文件夹,其中存在
wsgi.py
文件

添加更多今天的代码:关于您的错误还有其他问题,例如或。你有没有研究过它们中的任何一个,为什么它们在你的案例中不起作用?嗨,谢谢你的回答。是的,我两个都试过了。在第一个示例中,我拥有所有依赖项,它正确地显示在需求中。。对于第二个,我也尝试了注册表位,但出现了相同的错误。有什么建议吗?有什么我可以尝试的吗?你可以用ssh连接到EB实例并从那里进行检查吗?手动尝试启动它,看看是否有任何错误。这样有助于确定自动化失败的原因。谢谢你们。我有wsgi,但运气不好。我会再次尝试两者,然后回到这里
aws:elasticbeanstalk:container:python:
 WSGIPath: config.wsgi:application