An API for motorsports historical data, starting with NASCAR data. Data include lists of Drivers, Teams, and Crew Chiefs along with Team/Car Standings and Race lists. Most endpoints allow variable specificity from 'all', down to specified by season (year) and series (i.e. Sprint Cup).
All Series designations conform to the convention specified below under Series Designations.
The following section describes the steps necessary to set up the API from scratch.
Begin by installing all required dependencies. We recommend using virtualenv to isolate this environment. It is also recommended that you use pip for package management. When you are in your environment, run:
pip install -r requirements.txt
This requires some environment variables that are not tracked.
Create a .env
file that includes the following:
DATABASE_URL=postgresql://localhost/{{your_local_db_name}}
DEBUG=True
Requires having Postgres (on a mac, we use Postgres.app) installed on your machine. First, create your empty database. From the shell:
createdb "your_local_db_name"
Then create the tables.
honcho run python ./app/manage.py database upgrade
(If there is no migrations
folder, which is the case early on, while we're trying to finalize the models, before you run upgrade you'll want to run the following.)
honcho run python ./app/manage.py database migrate
After you have initialized the application per API Configuration & Initial Setup
,
running the API locally is easy:
./bin/devserver.sh
Now you can hit the API by navigating to http://127.0.0.1:5000/api/{endpoint}
You can deploy this to any production environment you choose. Below we describe how to deploy to Heroku.
Follow steps at Heroku.com
git push heroku master
We use nose for running tests. To run the full test suite make sure Postgres is running then use:
nosetests -v test
The testing database is postgresql://localhost/historic_api_test
by
default and can be overridden by specifying the TEST_DATABASE_URL
variable in your environment.
* w - NASCAR Sprint Cup Series
* b - NASCAR Nationwide Series
* c - NASCAR Camping World Truck Series
* p - K&N Pro Series West
* e - K&N Pro Series East
* o - Indy Cup
* a - ARCA
* f - Formula One
* ga - GrandAm
- We deploy most of our applications to Heroku and structure them as described in The Twelve Factor App.
- We typically keep all configuration variables in files like
.env
and.env.production
which we source using foreman or the Python clone honcho.
- Flask for the application framework;
- Flask-SQLAlchemy for the ORM;
- Flask-Script for management scripts;
- Alembic and Flask-Migrate for schema migrations;
See the LICENSE file.
- Kyle Jensen
- Alejandro Mesa
- Gilman Callsen
- ...please add your name here when you make your first commit