Ryan
Ryan

Reputation: 709

First time Django database SQL or NoSQL?

I've been learning Python through Udacity, Code Academy and Google University. I'm now feeling confident enough to start learning Django. My question is should I learn Django on an SQL database - either SQLite or MySQL; or should I learn Django on a NoSQL database such as Mongo?

I've read all about both but there's a lot I don't understand. Mongo sounds better/easier but at the same time it sounds better/easier for those that already know Relational Databases very well and are looking for something more agile.

Upvotes: 3

Views: 5770

Answers (4)

speedplane
speedplane

Reputation: 16141

According to their wiki, Django does not officially support NoSQL databases (a poor decision IMHO). So if you go the NoSQL route on Django, you'll need to be comfortable dealing with non-standard forks of the project and errors that may not be well documented.

So for beginners on Django, SQL is an obvious choice.

That said, my first DB on Django was a NoSQL one, but I had used SQL databases on other platforms previously.

Upvotes: 0

Kevin London
Kevin London

Reputation: 4728

As a beginner, it will probably be easiest to learn Django using sqlite. You only need to provide a location for the database and to specify sqlite3 as your backend to get it working, which is nice. If you want to use postgres later, it'll be more work but it's still feasible. See @JonathanVanasco's note in the comments.

If you want to eventually use a NoSQL DB, Django doesn't support it currently. Here is the list of recognized 3rd party Django backends.

You could use Mongo through a third party fork known as django-nonrel, but this particular implementation doesn't support ManyToManyFields and has a few other limitations. You can read more about Mongo in django-nonrel at this blog post. There's some more unofficial documentation on django-nonrel here.

Upvotes: 6

Pratik Mandrekar
Pratik Mandrekar

Reputation: 9566

sqlite is the simplest to start with. If you already know SQL toss a coin to choose between MySQL and Postgres for your first project!

Upvotes: 0

Skylar Saveland
Skylar Saveland

Reputation: 11464

Postgres is a great database for Django in production. sqlite is amazing to develop with. You will be doing a lot of work to try to not use a RDBMS on your first Django site.

One of the greatest strengths of Django is the smooth full-stack integration, great docs, contrib apps, app ecosystem. Choosing Mongo, you lose a lot of this. GeoDjango also assumes SQL and really loves postgres/postgis above others - and GeoDjango is really awesome.

If you want to use Mongo, I might recommend that you start with something like bottle, flask, tornado, cyclone, or other that are less about the full-stack integration and less assuming about you using a certain ORM. The Django tutorial, for instance, assumes that you are using the ORM with a SQL DB.

Upvotes: 1

Related Questions