Django SQLite3,尝试写入只读数据库

2024-09-27 00:20:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用sqlite3作为我的项目的数据库,当我通过键入python manage.py runserver手动提供临时端口时,它就工作了。但是,在部署到apache服务器后,会引发异常,如下图所示。起初,我认为这是一个文件权限问题,当我在django中运行命令时,例如python manage.py runserverpython manage.py mycommandpython manage.py createsuperuser,错误不会发生并且正在工作,但当我使用在/etc/apache2/sites-enabled/000-default.conf中创建的指定端口时,错误就会出现。我使用ubuntu 20.04和apache 2.4.41作为我的环境,下面的虚拟主机配置是我为我的项目指定的端口

Listen 112
<VirtualHost *:112>
    Alias /assets /home/yuan04/Projects/Lotto/assets
    <Directory /home/yuan04/Projects/Lotto/assets>
         Require all granted
    </Directory>
    <Directory /home/yuan04/Projects/Lotto/lotto>
        <Files wsgi.py>
            Require all granted
        </Files>
        <Files db.sqlite3>
            Require all granted
        </Files>
    </Directory>

    WSGIDaemonProcess lotto python-home=/home/yuan04/Projects/Lotto/venv python-path=/home/yuan04/Projects/Lotto
    WSGIProcessGroup lotto
    WSGIScriptAlias / /home/yuan04/Projects/Lotto/lotto/wsgi.py
</VirtualHost>

django sqlite3 error


Tags: 端口pyhomemanagerequirefilesallsqlite3

热门问题