Database Connect Error: Centos 6 / Apache 2.4 / Postgres 9.4 / Django 1.9 / mod_wsgi 3.5 / python 2.7
<p>I am trying to get my website up and running.   Everything seems to work fine, but when I go to a page with a database write - I get this:</p>

<pre><code>[Wed Oct 19 09:53:12.319824 2016] [mpm_prefork:notice] [pid 12411] AH00173: SIGHUP received.  Attempting to restart
[Wed Oct 19 09:53:13.001121 2016] [ssl:warn] [pid 12411] AH01909: sXXX-XXX-XXX-XXX.secureserver.net:443:0 server certificate does NOT include an ID which matches the server name
[Wed Oct 19 09:53:13.003578 2016] [mpm_prefork:notice] [pid 12411] AH00163: Apache/2.4.18 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 mod_wsgi/3.5 Python/2.7.6 configured -- resuming normal operations
[Wed Oct 19 09:53:13.003590 2016] [core:notice] [pid 12411] AH00094: Command line: '/usr/local/apache/bin/httpd'
(XID fsf92m) Database Connect Error: Access denied for user 'leechprotect'@'localhost' (using password: YES)
[Wed Oct 19 09:53:17.637487 2016] [mpm_prefork:notice] [pid 12411] AH00169: caught SIGTERM, shutting down
</code></pre>

<p>This line shows that a user "leechprotest" cannot connect:</p>

<pre><code>(XID fsf92m) Database Connect Error: Access denied for user 'leechprotect'@'localhost' (using password: YES)
</code></pre>

<p>However I don't have a user called leechprotect.  leechportect is a default user on MySQL (im guessing), because MySQL is installed as the default database on my dedicated server.</p>

<p>My Django settings.py file:</p>

<pre><code>DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'prelaunch_db',
        'USER': 'postgres_user',
        'PASSWORD': 'XXXXXXXXXXXXXXX',
        'HOST': 'localhost',
        'PORT': '',
    }
}
</code></pre>

<p>I already know my database and entire site works on my test server at home.   I think it might be interference with MySQL and PostgreSQL.</p>

<p>Any help much appreciated. </p>

<p>EDIT (After disabling leech protection):</p>

<pre><code>[Wed Oct 19 11:40:24.000919 2016] [ssl:warn] [pid 14754] AH01909: sXXX-XXX-XXX-XXX.secureserver.net:443:0 server certificate does NOT include an ID which matches the server name
[Wed Oct 19 11:40:24.001851 2016] [suexec:notice] [pid 14754] AH01232: suEXEC mechanism enabled (wrapper: /usr/local/apache/bin/suexec)
[Wed Oct 19 11:40:24.001887 2016] [:notice] [pid 14754] ModSecurity for Apache/2.9.0 (http://www.modsecurity.org/) configured.
[Wed Oct 19 11:40:24.001892 2016] [:notice] [pid 14754] ModSecurity: APR compiled version="1.5.2"; loaded version="1.5.2"
[Wed Oct 19 11:40:24.001897 2016] [:notice] [pid 14754] ModSecurity: PCRE compiled version="8.38 "; loaded version="8.38 2015-11-23"
[Wed Oct 19 11:40:24.001900 2016] [:notice] [pid 14754] ModSecurity: LUA compiled version="Lua 5.1"
[Wed Oct 19 11:40:24.001903 2016] [:notice] [pid 14754] ModSecurity: LIBXML compiled version="2.9.2"
[Wed Oct 19 11:40:24.001905 2016] [:notice] [pid 14754] ModSecurity: Status engine is currently disabled, enable it by set SecStatusEngine to On.
[Wed Oct 19 11:40:25.001596 2016] [ssl:warn] [pid 14755] AH01909: sXXX-XXX-XXX-XXX.secureserver.net:443:0 server certificate does NOT include an ID which matches the server name
[Wed Oct 19 11:40:25.004276 2016] [mpm_prefork:notice] [pid 14755] AH00163: Apache/2.4.18 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 mod_wsgi/3.5 Python/2.7.6 configured -- resuming normal operations
[Wed Oct 19 11:40:25.004294 2016] [core:notice] [pid 14755] AH00094: Command line: '/usr/local/apache/bin/httpd -D SSL'
(XID 6jmrjj) Database Connect Error: Access denied for user 'leechprotect'@'localhost' (using password: YES)
[Wed Oct 19 11:40:31.847492 2016] [mpm_prefork:notice] [pid 14755] AH00169: caught SIGTERM, shutting down
</code></pre>

<p>EDIT 2:</p>

<p>I found that Apache comes preconfigured on cPanel with a rewrite function:</p>

<p>These lines are in the httpd.conf file:</p>

<pre><code>RewriteEngine on
RewriteMap LeechProtect prg:/usr/local/cpanel/bin/leechprotect
Mutex file:/usr/local/apache/logs rewrite-map
</code></pre>

<p>I tried to comment out these lines, but cPanel jut regenerates the default file. I looked how to edit and I found:</p>

<pre><code>[root@sXXX-XXX-XXX-XXX]# /usr/local/cpanel/bin/apache_conf_distiller --update
</code></pre>

<p>From what I see, anyting written outside the  tag with be perminantly saved when running the above command.</p>

<p>this got rid of the Database error problem.  But I still get a 500 server error.  And all other error log messages are the same.</p>

<p>MySQL and PostgreSQL both do not come along with a user called 'leechprotect'. But a google search points out, that this username <a href="https://confluence2.cpanel.net/display/1152Docs/Leech+Protect" rel="nofollow">is related to cPanel</a> - might be worth reading that to understand whats going on. Afterwards you might consider deactivating it for you project directory.</p>

python mysql django apache postgresql