python - Apache 500 内部服务器错误 - DJANGO

标签 python html django apache ubuntu

我对以下错误消息有疑问:

Error: "500 Internal Server Error"



我在 apache2 上启动 django 项目。

APACHE2 配置文件:
<VirtualHost *:80>
ServerAdmin biisguzar@gmail.com
ServerName asistan.com
ServerAlias www.asistan.com
DocumentRoot /var/www/asistan


Alias /static/ /var/www/asistan/static/
WSGIScriptAlias / "/var/www/asistan/asistan/wsgi.py"


<Directory /var/www/asistan>
Order allow,deny
Allow from all
</Directory>


</VirtualHost>

DJANGO WSGİ.PY 文件:
import os,sys
sys.path.append('/var/www')
sys.path.append('/var/www/asistan')

sys.path.append('/var/www/asistan/asistan')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "asistan.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

页码:

enter image description here

最佳答案

在您的 settings.py 中,确保您已将变量 ALLOWED_HOSTS 设置为包含您的域名。如果不是,只要变量 DEBUG 设置为 False,您就会收到 500 错误。例如:

ALLOWED_HOSTS = ['mydomain.com']

Here's the documentation for ALLOWED_HOSTS

关于python - Apache 500 内部服务器错误 - DJANGO,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27462842/

相关文章:

python - 使用虚拟 ListCtrl 在 wxpython 中复制并粘贴行

javascript - "readyState === ' Interactive' "and "Jquery.ready() 之间的差异

html - 如何将我的按钮放在 Ruby on rails 的中心?

javascript - 如何创建一个 JS 函数将 `width:100%` 除以 `th` 的数字?

Django 从一个页面重定向到另一个页面

python - Django UpdateView 没有表单来更新对象

python - 从 DJango 中的 HTML 模板访问数据库模型

python - Latex 与 IPython (IPython) 错误

python - 从字节文件中查找拜耳模式格式

python - 为 scipy.optimize.curve_fit 函数中的各个独立点分配边界