zcash-grant-system/backend
Will O'Beirne 08afe6cec2
Start ganache. Example test for python to pass.
2018-09-11 16:00:15 -04:00
..
grant initial commit 2018-09-10 11:55:26 -05:00
migrations initial commit 2018-09-10 11:55:26 -05:00
requirements initial commit 2018-09-10 11:55:26 -05:00
tests Start ganache. Example test for python to pass. 2018-09-11 16:00:15 -04:00
.env.example initial commit 2018-09-10 11:55:26 -05:00
.gitignore initial commit 2018-09-10 11:55:26 -05:00
.isort.cfg initial commit 2018-09-10 11:55:26 -05:00
.pre-commit-config.yaml initial commit 2018-09-10 11:55:26 -05:00
.travis.yml initial commit 2018-09-10 11:55:26 -05:00
LICENSE initial commit 2018-09-10 11:55:26 -05:00
Procfile initial commit 2018-09-10 11:55:26 -05:00
README.md initial commit 2018-09-10 11:55:26 -05:00
app.py initial commit 2018-09-10 11:55:26 -05:00
requirements.txt initial commit 2018-09-10 11:55:26 -05:00
setup.cfg initial commit 2018-09-10 11:55:26 -05:00

README.md

Grant.io Backend

This is the backend component of Grant.io.

Database Setup

Run the following commands to bootstrap your environment. Note: db setup is configured in .env when running locally. SQLLite is used by default in /tmp/

# Get python in a virtual environment
virtualenv -p python3 venv
source venv/bin/activate

# Install python requirements
pip install -r requirements/dev.txt

# Create environment variables file, edit as needed
cp .env.example .env

Once you have installed your DBMS, run the following to create your app's database tables and perform the initial migration

flask db migrate
flask db upgrade

Running the App

Depending on what you need to run, there are several servies that need to be started

If you just need the API, you can run

flask run

Deployment

To deploy

export FLASK_ENV=production
export FLASK_DEBUG=0
export DATABASE_URL="<YOUR DATABASE URL>"
flask run       # start the flask server

In your production environment, make sure the FLASK_DEBUG environment variable is unset or is set to 0.

Shell

To open the interactive shell, run

flask shell

By default, you will have access to the flask app.

Running Tests

To run all tests, run

flask test

Migrations

Whenever a database migration needs to be made. Run the following commands

flask db migrate

This will generate a new migration script. Then run

flask db upgrade

To apply the migration.

For a full migration command reference, run flask db --help.

Commands

To create a proposal, run

flask create_proposal "FUNDING_REQUIRED" 1 123 "My Awesome Proposal" "### Hi! I have a great proposal"