Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django apache内部服务器错误_Django_Apache_Mod Wsgi - Fatal编程技术网

Django apache内部服务器错误

Django apache内部服务器错误,django,apache,mod-wsgi,Django,Apache,Mod Wsgi,当我尝试连接到django项目时,出现了“500内部服务器错误” 我尝试了很多方法来设置配置文件,包括一些关于stackoverflow的方法。但我还是解决不了这个问题。有人能帮我吗?多谢各位 这是我的vhost wsgi配置 <Directory "/home/antus/bazoo/Antus_Bazoo_Web"> <Files wsgi.py> Require all granted </Files> </Directory&

当我尝试连接到django项目时,出现了“500内部服务器错误”

我尝试了很多方法来设置配置文件,包括一些关于stackoverflow的方法。但我还是解决不了这个问题。有人能帮我吗?多谢各位

这是我的vhost wsgi配置

<Directory "/home/antus/bazoo/Antus_Bazoo_Web">
  <Files wsgi.py>
      Require all granted
  </Files>
</Directory>

WSGIDaemonProcess antus_bazoo python- 
path=/home/antus/bazoo:/home/antus/bazoo/bazoo_env/lib/python3.7/site- 
packages display-name=antus_bazoo python-home=/home/antus/bazoo/bazoo_env
WSGIProcessGroup antus_bazoo
WSGIScriptAlias / /home/antus/bazoo/Antus_Bazoo_Web/wsgi.py process- 
group=antus_bazoo
<>我也保存错误日志中的错误,但是它没有任何要考虑的东西,甚至文件也没有被创建。

  • 更新
这是Vhost配置

<VirtualHost *:80>
        ServerName mywebsite
        ServerAlias www.mywebsite
        ServerAdmin webmaster@mywebsite
        DocumentRoot /home/antus/public_html
        UseCanonicalName Off
        ScriptAlias /cgi-bin/ /home/antus/public_html/cgi-bin/

        # Custom settings are loaded below this line (if any exist)
        Include /usr/local/apache/conf/userdata/antus/bazoo/*.conf


        ErrorLog /usr/local/apache/logs/userdata/antus/bazoo/error_log
        CustomLog /usr/local/apache/logs/userdata/antus/bazoo/custom_log combined

        <IfModule mod_userdir.c>
                UserDir disabled
                UserDir enabled antus
        </IfModule>

        <IfModule mod_suexec.c>
                SuexecUserGroup antus antus
        </IfModule>

        <IfModule mod_suphp.c>
                suPHP_UserGroup antus antus
                suPHP_ConfigPath /home/antus
        </IfModule>

        <Directory "/home/antus/public_html">
                AllowOverride All
        </Directory>

</VirtualHost>

服务器名我的网站
服务器别名www.mywebsite
服务器管理员webmaster@mywebsite
DocumentRoot/home/antus/public\u html
UseCononicalName关闭
ScriptAlias/cgi-bin//home/antus/public\u html/cgi-bin/
#自定义设置加载在此行下方(如果存在)
Include/usr/local/apache/conf/userdata/antus/bazoo/*.conf
ErrorLog/usr/local/apache/logs/userdata/antus/bazoo/error\u log
CustomLog/usr/local/apache/logs/userdata/antus/bazoo/custom_-log组合
UserDir已禁用
启用UserDir的antus
鹿茸
SUPPP_用户组antus antus
suPHP\u配置路径/主页/antus
允许超越所有
如果出现“500内部服务器错误”,则表明服务器出现了问题,并且看到wsgi.py有一个文件打开操作,我会从那里开始查找错误,同时也看到您提到的关于“文件未创建””的内容

上面的行不会创建文件。要使用open()创建文件,请使用:


另外,一些日志对调试这一点也有很大帮助

您至少可以添加您的日志文件吗,我们不能以这种方式帮助您。这可能有一百万个原因。还要添加有关virtualenv、python和django版本等的更多信息。如果没有创建日志文件,只需打开settings.py并启用调试!然后,您将不会看到500错误,您将看到错误堆栈您确定您的Apache用户有权在/home/antus中读写吗?@InesTlili调试已启用,但仍然没有任何功能。@DanielRoseman我已将Apache添加到我的用户组中。
<VirtualHost *:80>
        ServerName mywebsite
        ServerAlias www.mywebsite
        ServerAdmin webmaster@mywebsite
        DocumentRoot /home/antus/public_html
        UseCanonicalName Off
        ScriptAlias /cgi-bin/ /home/antus/public_html/cgi-bin/

        # Custom settings are loaded below this line (if any exist)
        Include /usr/local/apache/conf/userdata/antus/bazoo/*.conf


        ErrorLog /usr/local/apache/logs/userdata/antus/bazoo/error_log
        CustomLog /usr/local/apache/logs/userdata/antus/bazoo/custom_log combined

        <IfModule mod_userdir.c>
                UserDir disabled
                UserDir enabled antus
        </IfModule>

        <IfModule mod_suexec.c>
                SuexecUserGroup antus antus
        </IfModule>

        <IfModule mod_suphp.c>
                suPHP_UserGroup antus antus
                suPHP_ConfigPath /home/antus
        </IfModule>

        <Directory "/home/antus/public_html">
                AllowOverride All
        </Directory>

</VirtualHost>
fh = open('/home/antus/bazoo/wsgi_hello.txt', 'w')
fh = open('/home/antus/bazoo/wsgi_hello.txt', 'w+')