I am developing a small app with the django framework and when trying to serve it via apache2 I get the following error:
(sqlite3.OperationalError) unable to open database file (Background on this error at: http://sqlalche.me/e/e3q8)
My settings.py entry for the database looks like that:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3')
}
}
The db file exists and has the following rights given by chmod:
root@myVPS:/var/www/lab# ls -l db.sqlite3
total 30236
-rwxrwxr-x 1 www-data www-data 3018568 Jul 1 22:14 db.sqlite3
The root folder /var/www/lab:
drwxrwxr-x 8 www-data www-data 4096 Jul 2 01:15 lab
I read that it might be a problem with the rights but I can't seem to find what I did wrong.
My Apache2 config file:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName sub.domain.com
ServerAlias sub.domain.com
DocumentRoot /var/www/lab
<Directory /var/www/lab>
Options FollowSymLinks
AllowOverride All
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /static /var/www/lab/static
<Directory /var/www/lab/static>
Require all granted
</Directory>
<Directory /var/www/lab/chatbot>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIScriptAlias / /var/www/lab/chatbot/wsgi.py
WSGIDaemonProcess django_app python-path=/var/www/lab python-home=/var/www/lab/venv
WSGIProcessGroup django_app
</VirtualHost>
I'm running Debian 8 with Python 3.5.3 and Django 2.2.3.
from Django - Unable to open database file (sqlite3.OperationalError)
No comments:
Post a Comment