Skip to content

whale-guru-dev/origin-website

 
 

Repository files navigation

origin_github_banner

origin_license

Head to https://www.originprotocol.com/developers to learn more about what we're building and how to get involved.

originprotocol.com

Official website for Origin Protocol

This is a Flask app with the source code for www.originprotocol.com. The code is all Python 2.7 with Postgres for the database (basically just for the mailing list). The database is not required to be configured if you're just working on the website.

Installing

Setup a virtualenv

virtualenv --python=/usr/local/bin/python2 origin-website && cd origin-website

Clone

git clone https://github.com/OriginProtocol/origin-website.git && cd origin-website

Enter virtual environment

source env.sh

Install requirements

pip install -r requirements.txt

Rename the file sample.env to .env, and update env variables as desired.

mv sample.env .env

Run it!

python main.py

Open browser to view

open http://127.0.0.1:5000/

Problems? Hit us up in the engineering channel on Discord if you need help.

Run the Tests

Throughout the development process and before committing or deploying, run:

pytest

Run individual test files simply as:

pytest path/to/test.py

Run a single test case, or an individual test, using:

pytest path/to/test.py::test_case_name

Running locally with Celery

We use Celery for running background tasks (mostly just sending emails). To get this working on your local machine, you'll want to make sure:

  • Your .env has CELERY_DEBUG: False
  • Redis is installed and running: redis-server
  • An active Celery worker is running: celery --loglevel=INFO -A util.tasks worker

Celery Flower is useful for monitoring tasks: flower -A util.tasks --port=5555

Localization

See translations directory.

Database changes

We use Flask Migrate to handle database revisions. If you make changes to the database, use flask db migrate to generate the required migration file and then flask db upgrade to implement and test your changes on your local database before committing.

Heroku Deploy

To deploy a development copy of the site on Heroku, just choose which branch you would like to use and follow the instructions:

stable branch
(v1.11.1)
master branch
(active development)
Deploy Deploy

Heroku will prompt you to set config variables. At a minium, you must set these two:

Config Value
FLASK_SECRET_KEY (make something up)
HOST (domain name of your dev heroku app)

See sample.env for a full list of other optional config variables. You can get Recaptcha keys from Google.

We use both the python and the nginx buildpacks:

heroku buildpacks:set heroku/python
heroku buildpacks:add https://github.com/heroku/heroku-buildpack-nginx

Contributing

We'd love to have you join us and contribute to this project. Please join our #engineering channel on Discord and read our guidelines on contributing to get started.

About

Code for originprotocol.com

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 58.7%
  • Python 23.0%
  • CSS 11.9%
  • JavaScript 6.0%
  • Other 0.4%