First step to Flask application factory
Move config to dict object
Move jsonp utility function to flaskutil module
Add app.mongo attribute
Move debug pages to blueprint
Make it harder to accidentally empty the database
Clean up imports
Introduce usersession module for browser session logic
Introduce get_session_id() function
Replace direct session access with calls to functions from usersession module
Move core server API to API blueprint
Refactor token generation
Reduce free variables in _load_flask_secret_key
Move and rename _load_flask_secret_key to secretkey module
Cleanup of imports
Extract method for secret key generation
Move debug flag into default config
Add config param to create_app()
Move app creation into main section
Remove superfluous ensure_session call in index page