Error acessing database after deploy on apache 2

Hello everybody,
The problem is the following, I developed an application with access to a mysql database, defined the access in the settings:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'OPTIONS': {
            'read_default_file': 'nfcReader/my.cnf',
        },
    },
}

the file has the accesses and it works, when I deployed it to apache 2 I stopped getting access to the database.
Syslog error:

Feb 16 16:07:10 raspberrypi mariadbd[693]: 2023-02-16 16:07:10 95 [Warning] Access denied for user 'www-data'@'localhost' (using password: NO)

apache config:

 Alias /static /var/www/nfcReader/static
                <Directory /var/www/nfcReader/static>
                         Require all granted
                 </Directory>

                 <Directory /var/www/nfcReader/nfcReader>
                         <Files wsgi.py>
                                 Require all granted
                         </Files>
                 </Directory>

        # WSGIDaemonProcess inov python-path=/var/www/nfcReader python-home=/home/inov/env
         #WSGIProcessGroup inov
        WSGIDaemonProcess inov  python-path=/var/www/nfcReader python-home=/home/inov/env
        WSGIProcessGroup inov
        WSGIScriptAlias / /var/www/nfcReader/nfcReader/wsgi.py

All works less the database connection, the user should stay the same? in th conf file i defined other user not the www-data
Any ideas?
best regards

There are two things I’d suggest doing:

  • Verify that the www-data account has access to that file.

  • Specify the file with the full, absolute path and not a relative path. (Your “base directory” of the Apache process may not be what you think it is.)

Thank you very mutch its the path to the file. With static path works like a charm