Я пытаюсь развернуть приложение django на VPS под управлением ubuntu 20.04.
I settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'OPTIONS': {
'read_default_file':'/home/ubuntu/arainc/auth/mysql.cnf'
},
}
}
И файл конфигурации:
#mysql.cnf
[client]
database = 'dbname'
user = 'dbuser'
password = 'dbuser@123'
default-character-set = 'utf8'
При попытке доступа к сайту я получаю следующую ошибку:
Environment:
Request Method: GET
Request URL: http://208.115.109.194/
Django Version: 3.0.7
Python Version: 3.8.2
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'araincdb',
'import_export',
'crispy_forms',
'django_filters',
'widget_tweaks']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback (most recent call last):
File "/home/ubuntu/arainc/venv/lib/python3.8/site-packages/django/contrib/sessions/backends/base.py", line 199, in _get_session
return self._session_cache
During handling of the above exception ('SessionStore' object has no attribute '_session_cache'), another exception occurred:
File "/home/ubuntu/arainc/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 220, in ensure_connection
self.connect()
File "/home/ubuntu/arainc/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 197, in connect
self.connection = self.get_new_connection(conn_params)
File "/home/ubuntu/arainc/venv/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/home/ubuntu/arainc/venv/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 233, in get_new_connection
return Database.connect(**conn_params)
File "/home/ubuntu/arainc/venv/lib/python3.8/site-packages/MySQLdb/__init__.py", line 130, in Connect
return Connection(*args, **kwargs)
File "/home/ubuntu/arainc/venv/lib/python3.8/site-packages/MySQLdb/connections.py", line 185, in __init__
super().__init__(*args, **kwargs2)
Exception Type: OperationalError at /
Exception Value: (1045, "Access denied for user 'www-data'@'localhost' (using password: NO)")
Я могу войти в базу данных с учетными данными в файле конфигурации.
Как я могу решить этот? Любая помощь будет очень признательна.