python sqlite3 OperationalError: attempt to write a readonly database

前端 未结 3 477
北恋
北恋 2021-01-07 23:02

I am trying to run a Flask REST service on CentOS Apache2 using WSGI. The REST service requires a very small storage. So i decided to use SQLite with sqlite3 py

相关标签:
3条回答
  • 2021-01-07 23:48

    What worked for me (I don't have sudo) was removing the database file and all migrations and starting again, as described here: How do I delete DB (sqlite3) in Django 1.9 to start from scratch?

    0 讨论(0)
  • 2021-01-07 23:50

    In addition to changing the database file permissions, you need also to change permissions for the directory that hosts the database file. You can try the following command:

    chmod 664 /path/to/your/directory/
    

    You can also change the directory's owner as follows:

    chown apache:apache /path/to/your/directory/
    
    0 讨论(0)
  • 2021-01-07 23:50

    run

    sudo chmod 777 path-to-your-djangoproject-directory 
    

    The directory should be the one which contains manage.py and db.sqlite3 files. (the parent container).

    Worked in my case.

    0 讨论(0)
提交回复
热议问题