Skip to content

charlieevett/jiffy-portal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

See the GFY architecture document.

This is what I've learned so far about setting up a system with mongo, flask, and beanstalkd

Table of Contents

Set up Mongo DB

See http://www.mongodb.org/ for full info.

Using a package manager is a good idea for installing this. On mac, you can use HomeBrew or MacPorts:

$ sudo port install mongodb

For linux you can use their apt repository -- See this page for instructions.

So far, I've just been running mongo locally on my machine from the command line:

$ mongod
Thu May 12 09:58:26 MongoDB starting : pid=72018 port=27017 dbpath=/data/db/ 64-bit
...
Thu May 12 09:58:26 [initandlisten] waiting for connections on port 27017
Thu May 12 09:58:26 [websvr] web admin interface listening on port 28017

Once you have it running you can check out the web admin ui.

Setting up the flask app

You can get the flask app ready to run using the build target in the Makefile:

$ make build
Updating submodules...
...
Creating the settings.py file...
Done.

This should update the deps directory, pulling in submodules for the dependencies for our flask+mongo apps:

Testing the app

Before you can test you need to install nose.

$ sudo easy_install pip
$ sudo pip install nose
Installing nose if needed...

Now you should be ready to run the tests. This is easily done using the Makefile test target.

$ make test
Running all tests...
..........
----------------------------------------------------------------------
Ran 10 tests in 0.503s

OK

Running the app

If the tests are working it's a good time to run the web app locally. This is done using the run target.

$ make run
 * Running on http://127.0.0.1:5000/
 * Restarting with reloader: stat() polling

Browse to localhost:5000 to check it out.

Checking code coverage

You can see how well the tests are covering the app by using the coverage target. This will run the tests with coverage turned on and then pop up your browser on the results:

$ make coverage
nosetests --with-coverage --cover-package=portal -w tests
..........
Name              Stmts   Miss  Cover   Missing
-----------------------------------------------
portal                0      0   100%
portal.app           13      0   100%
portal.forms         15      0   100%
portal.login         33      0   100%
portal.models        30      0   100%
portal.settings       4      0   100%
portal.users         46      0   100%
-----------------------------------------------
TOTAL               141      0   100%
----------------------------------------------------------------------
Ran 10 tests in 0.573s

OK
coverage html --d coverage_html --include=portal/*
open coverage_html/index.html

About

Tests of mongo, flask, etc.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages