OperationalError:尝试在Ubuntu服务器上写入只读数据库 [英] OperationalError: attempt to write a readonly database in ubuntu server

查看:179
本文介绍了OperationalError:尝试在Ubuntu服务器上写入只读数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu服务器上使用 mod_wsgi apache2 运行FlaskApp。我尝试在 localhost 上成功运行烧瓶应用程序,然后将其部署到ubuntu服务器上。



但是当我尝试更新数据库,其错误提示:无法更新模型。 (OperationalError)试图写一个只读数据库u'UPDATE mysongs SET songurl =? WHERE songid.id =?'(u'www.site.com / I_wanna_dance',1)



现在我试着寻找数据库文件权限是: -rwxr-xr-x 1 www-data www-data 10240 Jul 14 15:35 /var/www/mywebsite/appfolder/appdata.db



当我尝试将权限更改为777,755,644等时,会显示另一个错误:无法打开数据库文件数据库文件在 localhost 但不在ubuntu服务器上正常工作。



另外我检查了目录权限for / var / var / www / var / www / mywebsite / var / www / mywebsite / appfolder 等等,都有 www-data:www-data 所有者的用户名和组。



我尝试了谷歌搜索,但没有任何适当的解决方案,而不是改变文件/目录权限的建议,我已经尝试过自己。
$ b

为什么不能读取/访问数据库文件?



请建议。

解决方案

解决了这个问题。这是由于数据库文件权限冲突。


I'm running a FlaskApp using mod_wsgi and apache2 on Ubuntu server. I tried running the flask app on localhost successfully and then deployed it on ubuntu server.

But when i try to update database, its giving error: Failed to update model. (OperationalError) attempt to write a readonly database u'UPDATE mysongs SET songurl=? WHERE songid.id = ?' (u'www.site.com/I_wanna_dance', 1)

Now i tried look for database file permission which is: -rwxr-xr-x 1 www-data www-data 10240 Jul 14 15:35 /var/www/mywebsite/appfolder/appdata.db

When i try changing permission to 777, 755, 644 etc. it shows another error: unable to open database file Although database file works fine with 644 permission on localhost but not on ubuntu server.

Also i checked permission of directories and for /var /var/www /var/www/mywebsite /var/www/mywebsite/appfolder etc., all have www-data:www-data as its owner username and group.

I tried googling and but no proper solution other than suggestion of changing file/dir permissions, which i have tried myself.

Why can't it read/access the database file?

Please suggest.

解决方案

Resolved the issue. It was due to database file permission conflict.

这篇关于OperationalError:尝试在Ubuntu服务器上写入只读数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆