Django-无法打开数据库文件(sqlite3.OperationalError)

Gab*_*sii 6 python sqlite django python-3.x

我正在使用django框架开发一个小型应用程序,当尝试通过Apache2服务时,出现以下错误:

(sqlite3.OperationalError)无法打开数据库文件(此错误的背景位于:http : //sqlalche.me/e/e3q8

settings.py输入的数据库如下所示:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3')
    }
}
Run Code Online (Sandbox Code Playgroud)

该数据库文件存在,并具有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
Run Code Online (Sandbox Code Playgroud)

根文件夹/var/www/lab

drwxrwxr-x 8 www-data www-data 4096 Jul 2 01:15 lab
Run Code Online (Sandbox Code Playgroud)

我读到版权可能有问题,但我似乎找不到我做错了什么。

我的Apache2配置文件:

<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>
Run Code Online (Sandbox Code Playgroud)

我正在使用Python 3.5.3和Django 2.2.3运行Debian 8。