Skip to content

python functions for trees > 150 cm in the FIA plots

License

Notifications You must be signed in to change notification settings

tinybike/bigtrees-flask

 
 

Repository files navigation

bigtrees-flask

https://travis-ci.org/tensorjack/bigtrees-flask.svg?branch=master https://coveralls.io/repos/tensorjack/bigtrees-flask/badge.png

Minimal "read from a csv in response to a user request, then show them the results" example web app, created using Flask.

Installation

First, clone this repository onto your computer by entering the following command into the terminal:

$ git clone https://github.com/tensorjack/bigtrees-flask

Once it is downloaded, go into the bigtrees-flask directory and install the app's dependencies (by convention, these are listed in a requirements.txt file):

$ cd bigtrees-flask
$ pip install -r requirements.txt

The second command installs the dependencies required by bigtrees-flask to run -- in this case, just Flask itself. Note: if you are not using a virtual environment, you may need to prepend sudo to the second command.

Usage

To run the web app on your localhost, go into the bigtrees-flask directory, and type:

$ python app.py

Open up your web browser and go to http://127.0.0.1:5000. Voila!

Tests

To illustrate how you can test a web app, I sketched out a few simple unit tests. They're in the /tests directory. To run these:

$ pip install -r test_requirements.txt
$ py.test tests/test_app.py --doctest-modules -v --cov app --cov-report term-missing

The cov and cov-report flags in the py.test command tells py.test to generate a coverage report -- that is, a report that tells you what lines in app.py are not covered by the unit tests. (Ideally, you want coverage to be at 100%. However, for web apps, there is often some "boilerplate" code that is not run during tests, such as the lines in the if __name__ == "__main__" block.)

Test results will appear in your terminal. If you want to access the coverage report later, it is stored in a file called .coverage (in the same directory).

About

python functions for trees > 150 cm in the FIA plots

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 52.1%
  • CSS 47.9%