News for hackers. Stuff that matters.
Re:Django SQLite Production Config by kissgyorgy on Saturday June 15, 2024 @09:01AM (#40689532)
I did the exact same thing yesterday, couple of notes:

If you subclass sqlite3.base.DatabaseWrapper, it will issue the required PRAGMAs defined by Django, where foreign_keys = ON and legacy_alter_table = OFF.

I don't think synchronous = NORMAL worth it, as there is a tiny-tiny chance you will lose data. The relevant section from SQLite doc: "A transaction committed in WAL mode with synchronous=NORMAL might roll back following a power loss or system crash."

IMMEDIATE mode might not be needed and your application might never get a database locked error, I would only use that when I see the first error.

You can read about mmap_size in depth here: https://oldmoe.blog/2024/02/03/turn-on-mmap-support-for-your...

There are no comments on this comment yet.