Apache 上的 Django 网站出现 wsgi 失败

发布于 2024-08-30 08:13:40 字数 1021 浏览 6 评论 0原文

我有一个用 django 构建的网站,我正在尝试在我们的企业 Apache 服务器(在 debian 上)上为我工作场所的内联网工作。不幸的是,每当我尝试导航到我的站点时,Apache 都会返回服务器错误。虽然我可以导航到 statics 文件夹。我的 Apache 配置和 wsgi 脚本如下所示...

lbirdf.wsgi

import os
import sys

sys.path.append('/home/lbi/rdfweb/web')
sys.path.append('/home/lbi/rdfweb/web/lbirdf')

os.environ['DJANGO_SETTINGS_MODULE'] = 'lbirdf.settings_production'

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

Apache 配置

Listen 8080

<VirtualHost *:8080>
ServerName server1
WSGIScriptAlias /rdfweb /home/lbi/rdfweb/web/lbirdf/apache/lbirdf.wsgi
Alias /statics /home/lbi/rdfweb/web/lbirdf/statics
Alias /admin_media /home/lbi/rdfweb/web/lbirdf/admin_media

<Directory /home/lbi/rdfweb/web/lbirdf/apache>
Order allow,deny
Allow from all
</Directory>

<Directory /home/lbi/rdfweb/web/lbirdf/admin_media>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

关于我可能会出错的地方有什么想法吗?

I have a website I've built in django that I'm trying to get working on our corporate Apache server (on debian) for our intranet at my workplace. Unfortunately, Apache keeps returning server errors whenever I try to navigate to my site. Although I can navigate to the statics folder. My Apache config and wsgi script look like the following...

lbirdf.wsgi

import os
import sys

sys.path.append('/home/lbi/rdfweb/web')
sys.path.append('/home/lbi/rdfweb/web/lbirdf')

os.environ['DJANGO_SETTINGS_MODULE'] = 'lbirdf.settings_production'

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

Apache config

Listen 8080

<VirtualHost *:8080>
ServerName server1
WSGIScriptAlias /rdfweb /home/lbi/rdfweb/web/lbirdf/apache/lbirdf.wsgi
Alias /statics /home/lbi/rdfweb/web/lbirdf/statics
Alias /admin_media /home/lbi/rdfweb/web/lbirdf/admin_media

<Directory /home/lbi/rdfweb/web/lbirdf/apache>
Order allow,deny
Allow from all
</Directory>

<Directory /home/lbi/rdfweb/web/lbirdf/admin_media>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Any ideas on where I might be going wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

瘫痪情歌 2024-09-06 08:13:40

Apache 错误日志中有哪些消息?尝试在 Django 设置文件中将 DEBUG 设置为 true,以便在您的应用程序中出现问题时将更多信息发送回浏览器。

可能的原因是, urls.py 是错误的,因为您在不需要时错误地包含了站点前缀,或者由于代码以 Apache 用户而不是您的身份运行而导致权限问题。

不知道实际的错误无助于解决问题。

What messages are in the Apache error log? Try setting DEBUG to true in Django settings file to get more informative error message sent back to browser in instance that it is an issue in your application.

Possible causes are, urls.py is wrong because you are erroneously including site prefix when you don't need to or a permissions issue because code running as Apache user and not you.

Not knowing the actual errors doesn't help in working out the problem.

爱冒险 2024-09-06 08:13:40

尝试:

sys.path.append('/home/lbi/rdfweb/')

Try:

sys.path.append('/home/lbi/rdfweb/')
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文