我对以下错误消息有疑问:
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()
页码:
最佳答案
在您的 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/