Git Product home page Git Product logo

bottle-mongodb-example's Introduction

Bottle + MongoDB Example

A didactic Web application written in Python to illustrate how to use the Bottle web-framework with the MongoDB database.

It’s a port I made of Mike Dirolf’s DjanMon application (how to use Django with MongoDB).

Bottle is a wonderful micro web-framework, it’s beautifully written and documented and has that ``just right'' feel about it. Bottle has support for multiple webservers and template engines — I’m really enjoying it after working with Django.

MongoDB is a schemaless document-oriented database designed for the Web. For me, working with MongoDB has been a revelation. Database creation, administration and migration (long the bane of database developers) is trivial in comparison with traditional SQL databases. Document storage management is baked into MongoDB and is used in many web applications (document storage has always been awkward and slow with relational databases).

This document is also published as a blogpost.

Here’s a screenshot.

To run the application install the prerequisite packages then:

git clone https://github.com/srackham/bottle-mongodb-example.git
cd bottle-mongodb-example
python bottle-mongodb-example.py

The application creates and displays a paged list of user created messages which are stored in a MongoDB database along with uploaded images (no file system management required it’s all in the database) — not bad for 93 lines of Python code and a 79 line HTML template. The really neat thing is that you don’t have to create the database, tables or schema — it all happens automatically.

Prerequisites

  • Python.

  • MongoDB (see the MongoDB website for install instructions).

  • PyMongo, the Python MongoDB driver:

    sudo easy_install pymongo
  • The Bottle web-framework:

    git clone https://github.com/defnull/bottle.git
    cd bottle
    python setup.py install

I’m running in this environment — it works for me but your mileage may vary:

  • Xubuntu 10.04

  • Bottle 0.9dev

  • Python 2.6.5

  • MongoDB 1.6.5

  • PyMongo 1.9

bottle-mongodb-example's People

Contributors

srackham avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.