Skip to content

Instantly share code, notes, and snippets.

@my-janala
Last active October 18, 2016 22:10
Show Gist options
  • Save my-janala/c64a2164a11cb8e0d7b544113dfe78b3 to your computer and use it in GitHub Desktop.
Save my-janala/c64a2164a11cb8e0d7b544113dfe78b3 to your computer and use it in GitHub Desktop.
MongoDB with Python Tutorial - partially copied from here https://github.com/behackett/presentations/blob/master/pycon_2012/Lesson%201.0.pdf

Follow instructions from here https://github.com/behackett/presentations/blob/master/pycon_2012/Lesson%201.0.pdf

Install MongoDB on MAC

https://docs.mongodb.com/v3.2/tutorial/install-mongodb-on-os-x/

$ which mongod
/opt/mongodb/bin/mongod
$ cat ~/.bashrc
export PATH=/opt/mongodb/bin:$PATH

Set up Tutorial

Now insert Data

$ wget https://raw.githubusercontent.com/behackett/presentations/master/pycon_2012/scores.json

Install virtualenv for the Tutorial

$ wget http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.7.1.2.tar.gz
$ tar xzvf virtualenv-1.7.1.2.tar.gz
$ cd virtualenv-1.7.1.2
$ python setup.py install
$ cd ../
$ virtualenv tutorial-env
$ source tutorial-env/bin/activate

Install pymongo and ipython

$ pip install pymongo ipython

Could not find .egg-info directory in install record for wcwidth (from prompt-toolkit>=1.0.3,<2.0.0->ipython)
  Running setup.py install for ptyprocess

  Could not find .egg-info directory in install record for ptyprocess>=0.5 (from pexpect->ipython)
Successfully installed pymongo ipython setuptools decorator pickleshare simplegeneric traitlets prompt-toolkit pygments appnope pexpect ipython-genutils six wcwidth ptyprocess
Cleaning up...

More packages are required

$ pip install backports.shutil_get_terminal_size

$ pip install backports.shutil_get_terminal_size enum34

$ ipython
Python 2.7.10 (default, Apr 16 2016, 22:55:54)
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment