Farmer's Markets is a simple API built with data from: https://catalog.data.gov/dataset/farmers-markets-geographic-data.
Backend: Python, Flask, Flask-RESTful PostgreSQL, PostGIS, SQLAlchemy, GeoAlchemy2
Frontend: JSON
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Python 2.7.0
- PostgreSQL
- Clone this repository:
$ git clone https://github.com/jttyeung/farmers-markets.git
- Set up a Python virtualenv and activate it.
$ virtualenv env
$ source env/bin/activate
- Install all app dependencies listed in requirements.txt.
$ pip install -r requirements.txt
- Make sure you have PostgreSQL running (psql).
- Create a database named farmers-markets.
$ createdb farmers-markets
- Open the database, add the PostGIS database extension, and exit out of the database.
$ psql farmers-markets
CREATE EXTENSION postgis;
\quit
- Create tables in your database.
$ python model.py
- Go into the /static/data/ directory and seed the database using the dump.sql file.
$ cd static/data
$ psql farmers-markets < dump.sql
- Start the Flask server.
$ python server.py
- Go to localhost:5000 to view the application.
To use the app, simply visit one of the REST API endpoints to retrieve data:
- /markets - This will give you data for all the markets in the U.S.
- /markets/<fm_id> - Search data by farmer's market ID.
- /markets/<state_id> - Search data by state ID. -- coming soon!
Joanne Yeung is a full-stack engineer in San Francisco, CA. Learn more on LinkedIn: https://linkedin.com/in/jttyeung
This project is licensed under the MIT License.