Note commands below assume Mac OS and homebrew is installed.
Install python. (You may have to set your path to override default python2):
brew install python
Install Openssl for psycopg dependency:
brew link openssl --force
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
Install Postgres:
brew install postgresql
brew install postgis
brew services start postgresql
psql -d postgres -c "CREATE EXTENSION postgis;"
Install Redis
brew install redis
brew services start redis
Install Elasticsearch
brew install elasticsearch
brew services start elasticsearch
Create a new virtual environment
python3 -m venv .venv
Activate your virtual environment. Or, automate venv activation so you never forget
source .venv/bin/activate
Install python packages:
pip install -r requirements/local.txt
Install pre-commit hooks
pre-commit install
Install the spaCy language model
python -m spacy download en_core_web_sm
After installing Postgres, you will need to create and migrate the database. Run from the shell:
psql postgres -c "CREATE DATABASE hyped"
python manage.py migrate
We use eslint, prettier, black, isort and flake8 in our codebase. Please enable these formatters and linters in your code editor. If you're using vim, try ale.
Install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
Use it:
nvm use
Install yarn:
brew install yarn
Install npm modules:
yarn install
For web app development on the node server, see the README file in frontend folder.
Set var in your shell:
export DJANGO_READ_DOT_ENV_FILE=1
Create a .env in the project root and add secret env var. For example:
PLAID_SECRET="foo"
Download the quarterly data, format it (follow existing format) and place it in
hypetrain/main/data/coli/quartery_data/year-quarter.csv
Run script from the shell
python manage.py runscript build_county_to_coli_map
Spot check build data using the newly created log in hypetrain/main/data/coli/logs
Commit log and regenerated file: hypetrain/main/data/county-to-coli.json
Deploy
Connect to production database and run
python manage.py runscript update_coli
We use celery beat to manage periodic tasks.
In your .env file, add:
CELERY_TASK_ALWAYS_EAGER=False
In a new terminal window, run the celery worker:
celery -A hypetrain worker --loglevel=info -n worker1
Make sure to restart your server
python manage.py runserver
python manage.py test
python manage.py search_index --delete
python manage.py search_index --create
python manage.py search_index --populate --parallel
python manage.py search_index --rebuild --parallel
python manage.py search_index --sync --parallel
Content type
Image
Digest
Size
1.3 GB
Last updated
over 5 years ago
docker pull placement/python3.7-nodejs12-base