Homunculus Reticulli
Homunculus Reticulli

Reputation: 68486

Python mongodb sample app

I am thinking of using mongodb for a custom application. I am new to mongodb, and I am looking for a sample application (minimal, but a little bit more useful than hello world), which shows how a small but useful application (e.g. a blog application), can be written using Python and mongodb.

Such a (small but useful) application will help me understand how to develop my application; particular how to go from the RDBMS way of thinking to the NoSQL mindset. However despite searching online for a while, I have not come accross such an example. Is anyone of such a "useful" or "realworld" sample app?

Upvotes: 0

Views: 1430

Answers (2)

Andrei Orlov
Andrei Orlov

Reputation: 918

Please see for https://github.com/mr0re1/NCR at Application/application/mongoloid.py. There is simple code which connects to MongoDB, and pass simple operations.

connection = pymongo.Connection(settings.MONGOLOID['host'], settings.MONGOLOID['port'])
db = connection[settings.MONGOLOID['database']]

Where descriptions of "host", "port" and "database" are in settings.py.

All operations are very simple, like this db['lexemes'].find(request), where "lexemes" is a collection name, and "request" is dictionary.

Upvotes: 1

Christian Witts
Christian Witts

Reputation: 11585

Introduction to Tornado actually has a section on building a blog using Tornado as the web-server and MongoDB as the database. The code for the book is available on GitHub as well if you want to read through it to get an understanding of how it works.

Upvotes: 1

Related Questions