Attempt to write a Read only database

Hi Guys hope you are doing well,

Here I am Using Ubuntu to run my Django project (Mayan EDMS Open source project ) after running success fully and tried to login into the application and I am not get into home page because of DB is in the read only Mode, can any one help in this will be appreciated.

Thanks in advance

Are you using default django sqlite3? if yes, then
You have to add writing rights to the directory in which your sqlite database is stored. So running chmod -R u+w /path/ should help.

After running “chmod -R u+w mayan/media/db.sqlite3” still getting same error
Any ways to get out of thiss?

can you share your folder structure tree

db.sqlite3 is in media folder have you specified this path, as it is not in root folder

1 Like

You should be running the chmod command on the path mayan/media and not the file.

(Note: If you’re looking to deploy this to a production-style environment, you probably don’t want your database in that directory. The last thing you want to have happen is to have someone be able to craft a url that accesses your media directory and allows them to download that file.)

1 Like

I run those commands without file, still getting same
any ways to get out of this?


Can you plz check out and which permission should i change?

What are the permissions on the media directory itself? (The directory, not the contents of the directory that you’re showing here.)

Also, how are you running your Django project?

I just made a “media” group and added to in that group except db.sqlite3 by it self

Unfortunately, that doesn’t answer my questions.

  1. What are the permissions on the media directory itself? (What do you get if you do an ls -l if mayan is your current directory?)

  2. How are you running your Django project? What commands or system configuration are you using for this? Is this intended to be a production deployment or is this your development environment?

image
Please check Above media file has permission
To run my django project “make runserver” and for development environment i am trying to run

As a development environment, then I’d say both the media directory and all its contents should have the same ownership as the rest of the files (sayed:sayed). There’s no need to start altering ownership and permissions until deployment.

1 Like

Resolved Man Thank a lot Man :slight_smile:

What if it’s a prod db where should i house the db

Any directory that the UID being used for your Django process can access. It more important that its placement fits within your general guidelines for how your server is managed.


i am getting the same error , can somebody solve

Welcome @proxd15 !

I suggest you open a new topic for this. This topic has been marked as solved and so your post is not likely going to attract attention.

When you do so, please don’t post images of code or text. Copy/paste the text into the body of your post, between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```. This forces the forum software to keep your code properly formatted.

In addition to the directory listing here, also please show how you’re running your Django project, and post the complete error message being received in the logs from your application.

General note: You do not want your project or database in the /var/www directory tree. Those files should remain outside the view of the web server and should only be accessible to the UID running the application. The only files that should possibly be in /var/www would be your static and media files.