cfpb / sheer

A tool for loading arbitrary content into Elasticsearch and serving that content on the web.
Creative Commons Zero v1.0 Universal
29 stars 23 forks source link

Add support for loading in individual Flask modules #59

Closed dpford closed 10 years ago

dpford commented 10 years ago

This adds the ability for sheer to use standalone Flask modules (more specifically, blueprints), loaded in via a blueprints.json file in the site's _settings folder.

To test it out, install the following packages inside your virtual environment:

pip install git+git://github.com/dpford/flask-govdelivery
pip install git+git://github.com/rosskarchner/govdelivery

Next, add the following to _settings/blueprints.json in your site:

{
  "flask_govdelivery":{
      "package" : "flask_govdelivery.govdelivery.controllers",
      "module" : "govdelivery"
    }
}

If all goes well, you should be able to go to the URL /form-test/ and get a success message, confirming the fact that the blueprint was loaded in, and the URL routes were setup.

dpford commented 10 years ago

Also, to run locally, this will require the environment variables outlined in the readme of this repo: https://github.com/dpford/flask-govdelivery

rosskarchner commented 10 years ago

This is pretty neat!