首页 > 解决方案 > 无法在基于 Django 的项目的数字海洋上使用 Apache 服务器为网站提供服务

问题描述

我在 Apache 服务器上提供了我的网站,它是基于 Django 的项目。我能够从一个月开始运行我的网站。现在,当我从 github 拉出我的存储库时,它现在显示 500 错误。当我激活我的虚拟环境并且我正在运行时python manage.py runserver my_ip_address,它会在终端中正确显示所有内容,但是当我试图在我的网络浏览器中过度使用时,它什么也没有显示。然后我试过python manage.py runserver my_ip_address:8080了,它工作正常。当我检查了我的 apache 服务器 error.log|tail 时,它显示了一些错误,我在下面附加了错误。我正在使用 postgres,当我最后一次拉动我的存储库时,之后python manage.py makemigrations 它要求我为我的一个领域提供一个默认时间,我提供了 timezone.now。在最后一个 git pull 我改变了很多东西,但是如果可能有错误,那么我python manage.py runserver my_ip_address:8080的虚拟主机应该不能工作,但它工作正常。我还重新启动了 apache 服务器service apache2 restart,并且还使用了 sudo。

错误日志

[Sun Aug 05 19:06:20.530154 2018] [wsgi:error] [pid 31141:tid 
140598172460800] [remote 136.232.1.166:12161]   File 
"/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 13, 
in get_wsgi_application
[Sun Aug 05 19:06:20.530173 2018] [wsgi:error] [pid 31141:tid 
140598172460800] [remote 136.232.1.166:12161]     
django.setup(set_prefix=False)
[Sun Aug 05 19:06:20.530182 2018] [wsgi:error] [pid 31141:tid 
140598172460800] [remote 136.232.1.166:12161]   File 
"/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 27, 
in setup
[Sun Aug 05 19:06:20.530196 2018] [wsgi:error] [pid 31141:tid 
140598172460800] [remote 136.232.1.166:12161]     
apps.populate(settings.INSTALLED_APPS)
[Sun Aug 05 19:06:20.530204 2018] [wsgi:error] [pid 31141:tid 
140598172460800] [remote 136.232.1.166:12161]   File 
"/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 
78, in populate
[Sun Aug 05 19:06:20.530218 2018] [wsgi:error] [pid 31141:tid 
140598172460800] [remote 136.232.1.166:12161]     raise 
RuntimeError("populate() isn't reentrant")
[Sun Aug 05 19:06:20.530236 2018] [wsgi:error] [pid 31141:tid 
140598172460800] [remote 136.232.1.166:12161] RuntimeError: populate() 
isn't reentrant

标签: pythondjangoapachedigital-ocean

解决方案


推荐阅读