【发布时间】:2022-01-23 12:12:36
【问题描述】:
我正在尝试使用 Apache 和 mod_wsgi 部署网站,我的项目有更多应用程序
Project/
├── Article
│ ├── __init__.py
│ ├── admin.py
│ ├── apps.py
│ ├── forms.py
│ ├── migrations
│ ├── models.py
│ ├── templates
│ ├── tests.py
│ ├── urls.py
│ └── views.py
├── Client
│ ├── __init__.py
│ ├── admin.py
│ ├── apps.py
│ ├── forms.py
│ ├── migrations
│ ├── models.py
│ ├── templates
│ ├── tests.py
│ ├── urls.py
│ └── views.py
├── ManagementSoftware
│ ├── __init__.py
│ ├── __pycache__
│ ├── admin.py
│ ├── apps.py
│ ├── forms.py
│ ├── migrations
│ ├── models.py
│ ├── static
│ ├── templates
│ ├── tests.py
│ ├── urls.py
│ └── views.py
├── Order
│ ├── __init__.py
│ ├── admin.py
│ ├── apps.py
│ ├── forms.py
│ ├── migrations
│ ├── models.py
│ ├── templates
│ ├── tests.py
│ ├── urls.py
│ └── views.py
├── Sites
│ ├── __init__.py
│ ├── admin.py
│ ├── apps.py
│ ├── forms.py
│ ├── migrations
│ ├── models.py
│ ├── templates
│ ├── tests.py
│ ├── urls.py
│ └── views.py
├── Supplier
│ ├── __init__.py
│ ├── admin.py
│ ├── apps.py
│ ├── forms.py
│ ├── migrations
│ ├── models.py
│ ├── templates
│ ├── tests.py
│ ├── urls.py
│ └── views.py
├── Project
│ ├── __init__.py
│ ├── __pycache__
│ ├── asgi.py
│ ├── settings.py
│ ├── settings.py.save
│ ├── urls.py
│ └── wsgi.py
├── db.sqlite3
├── manage.py
└── requiements.txt
我已经设置了这样的 Apache 配置文件
<VirtualHost *:80>
ServerAlias project.xyz
<Directory /var/www/vhosts/Project/Project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess Project python-home=/var/www/vhosts/Prohect/env/
WSGIProcessGroup Project
WSGIScriptAlias / /var/www/vhosts/Project/Project/wsgi.py process-group=Project
Alias /static/ /var/www/vhosts/Project/ManagementSoftware/static/
<Directory /var/www/vhosts/Project/ManagementSoftware/static>
Require all granted
</Directory>
</VirtualHost>
当我启动项目时,我收到错误 500 内部服务器错误。 当应用程序只有一个应用程序(ManagmentSoftware)时,它曾经可以工作,所以我很确定问题出在那个变化上。
提前谢谢大家,我已经尝试搜索了几个小时但我找不到任何东西
编辑 - Apache 日志
[Sun Jan 23 14:08:08.310471 2022] [wsgi:error] [pid 48106:tid 140244498315008] [remote 79.53.204.195:37790] Traceback (most recent call last):
[Sun Jan 23 14:08:08.310502 2022] [wsgi:error] [pid 48106:tid 140244498315008] [remote 79.53.204.195:37790] File "/var/www/vhosts/Project/Project/wsgi.py", line 21, in <module>
[Sun Jan 23 14:08:08.310523 2022] [wsgi:error] [pid 48106:tid 140244498315008] [remote 79.53.204.195:37790] application = get_wsgi_application()
[Sun Jan 23 14:08:08.310531 2022] [wsgi:error] [pid 48106:tid 140244498315008] [remote 79.53.204.195:37790] File "/var/www/vhosts/Project/env/lib/python3.8/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Sun Jan 23 14:08:08.310534 2022] [wsgi:error] [pid 48106:tid 140244498315008] [remote 79.53.204.195:37790] django.setup(set_prefix=False)
[Sun Jan 23 14:08:08.310540 2022] [wsgi:error] [pid 48106:tid 140244498315008] [remote 79.53.204.195:37790] File "/var/www/vhosts/Project/env/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
[Sun Jan 23 14:08:08.310543 2022] [wsgi:error] [pid 48106:tid 140244498315008] [remote 79.53.204.195:37790] apps.populate(settings.INSTALLED_APPS)
[Sun Jan 23 14:08:08.310549 2022] [wsgi:error] [pid 48106:tid 140244498315008] [remote 79.53.204.195:37790] File "/var/www/vhosts/Project/env/lib/python3.8/site-packages/django/apps/registry.py", line 83, in populate
[Sun Jan 23 14:08:08.310552 2022] [wsgi:error] [pid 48106:tid 140244498315008] [remote 79.53.204.195:37790] raise RuntimeError("populate() isn't reentrant")
[Sun Jan 23 14:08:08.310566 2022] [wsgi:error] [pid 48106:tid 140244498315008] [remote 79.53.204.195:37790] RuntimeError: populate() isn't reentrant
【问题讨论】:
-
转到 /var/log/apache2/error.log 并告诉我们您收到的错误信息
-
编辑了问题:)
-
你试过我给你的配置了吗?
标签: python-3.x django