Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django: sqlite for dev, mysql for prod? [closed]

Tags:

Quick question: is it a good idea to use sqlite while developing a Django project, and use MySQL on the production server?

like image 836
Jason Miesionczek Avatar asked Feb 21 '10 13:02

Jason Miesionczek


People also ask

Can you use SQLite in production Django?

It is not impossible to use Django with Sqlite as database in production, primarily depending on your website/webapp traffic and how hard you hit your db (alongside what kind of operations you perform on it i.e. reads/writes/etc).

Why is SQLite not good for production?

The biggest problem with using SQLite in production is disaster recovery. If your server dies, so does your data. That's… not good. Other database servers have replication so they can stream database changes to another server in case one goes down.


2 Answers

I'd highly recommend using the same database backend in production as in development, and all stages in between. Django will abstract the database stuff, but having different environments will leave you open to horrible internationalisation, configuration issues, and nasty tiny inconsistencies that won't even show up until you push it live.

Personally, I'd stick to mysql, but I never got on with postgres :)

like image 121
Aquarion Avatar answered Oct 30 '22 21:10

Aquarion


I second all previous answers, adding some explicit reasons:

  • MySQL issues Warning exception when you try to store string longer that field width - you won't get them in SQLite, so not only you're string will be different between dev and production, but also program behaviour
  • bugs in both backends are different - I remember that once I tried SQLite for dev and MySQL for production, but it turned out that I discovered a bug in MySQL backend which was not present in SQLite one. So I filed a ticket for it and switched to MySQL for testing :-)

And you can even try to compete with SQLite in terms of speed, take a look at my answer for other question:

Increase speed for MySQL table creation in Django?

like image 29
Tomasz Zieliński Avatar answered Oct 30 '22 21:10

Tomasz Zieliński