Connect-SharkWeek
Public API for Sharknado using the JSON API 1.0 Spec Newsfeed spec
Development
Make sure you have the following installed:
- postgresql 9.4
- python 3.5.1
We recommended that you use
virtualenv
,
virtualenvwrapper
, or a
similar tool to keep your development environment isolated from the
rest of your system.
Install all requirements:
make develop
Test code quality:
make quality
Run tests:
make test
Here are the commands for setting up the DB:
$ python manage.py create_db
$ python manage.py db init
$ python manage.py db migrate
$ python manage.py db upgrade
To start the app in local development mode:
make run
Application Configuration
Application configuration is handled by the OS environment variable SHARK_APP_SETTINGS. Set this to one of the classes in app/config.py. For example:
For local development mode (this is the default): SHARK_APP_SETTINGS=app.config.DevelopmentConfig
For production mode: SHARK_APP_SETTINGS=app.config.ProductionConfig
Use the following environment variables to override the defaults in app/config.py.
Settings for this Flask app:
- SHARK_HOST
- SHARK_SECRET
- SHARK_PORT
- SHARK_NEWSFEED_LIMIT (default = 30)
- SHARK_LOGGING_LEVEL (default = info)
Settings for the backend DB:
- SHARK_DB_USER
- SHARK_DB_PASS
- SHARK_DB_ADDR
- SHARK_DB_NAME
Basic Heroku Deployment
Local Database (not needed if connecting to a remote DB)
Create a new postgres db:
heroku addons:create heroku-postgresql:hobby-dev
Initialize the local postgres DB on heroku:
heroku run python manage.py create_db
heroku run python manage.py db migrate
Get info on the postgres DB:
heroku pg:info
Helpful toolbelt commands for troubleshooting
Tell heroku that you need to run 1 dyno:
heroku ps:scale web=1
See that the web app is running:
heroku ps
See environment variables:
heroku config
Tail the logs:
heroku logs --tail