iric-data
IRIC Data Portal development effort
New DEV installation
# Clone repo and install pypi packages
cd <somewhere>
git clone git@gitlab.iric.ca:bioinfo_iric/iric-data.git
cd iric-data
# Create a virtenv, py3
module add python/3.6.7
python -m venv .venv
# Activate venv
source .venv/bin/activate
pip install --upgrade pip # update pip version to latest
pip install -r requirements.txt
# Install node modules
module add node
npm install
# run default gulp job to generate CSS/JS resources
gulp
# NB: gulp will keep running in "listening" mode, so open a new shell to keep going
# DB setup
## (login to postgresql server)
CREATE USER iric_data_user WITH PASSWORD 's0me_new_p4ssword';
CREATE DATABASE iric_data_dev;
GRANT ALL PRIVILEGES ON DATABASE iric_data_dev TO iric_data_user;
## Project requires the hstore extension be activated
### Need to be admin on postgresql
CREATE EXTENSION IF NOT EXISTS hstore;
# END DB setup
# update .env to local settings
cp .env.example .env
# Make edits to .env file (including db user passwd !)
Run project locally
# If you need to drop the DB tables
# login postgreSQL server and connect to db
DROP OWNED BY iric_data_user;
# with active virtenv
## Initial deploy:
python manage.py migrate
python manage.py populate_iric
## If NOT initial deploy (safe to run if no migrations exist)
python manage.py migrate portal
# Run without SSL
python manage.py runserver
# Site is now accessible at:
# http://127.0.0.1:8000
Deploy
git pull origin master
gulp prod
source .venv/bin/activate
python manage.py collectstatic
python manage.py migrate portal
touch iric_data/wsgi.py
Initial Deploy
# as adsoft, setup environment
sudo yum remove mod_wsgi
sudo yum install python34-devel
sudo pip3 install mod_wsgi
sudo mod_wsgi-express install-module
sudoedit /etc/httpd/conf.d/aa.conf
cd /var/www/private
git clone git@gitlab.iric.ca:bioinfo_iric/iric-data.git
cd
python3 -m venv .venv_local
source /var/www/private/iric-data/.venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
module add node
npm install
gulp prod
cp .env.example .env
# edit .env file
python manage.py migrate
sudo systemctl restart httpd
Translations
Make sure your virtual environment is active
django-admin makemessages -l fr
emacs portal/locale/fr/LC_MESSAGES/django.po # (or install gettext extension of choice)
django-admin compilemessages
DB Migrations
Django documentation tl;dr
python manage.py migrate portal [migration_name]
If migration_name is omitted, ALL migrations will be applied. Specify a migration_name to apply migrations up to that one and no further. This can be used to un-apply a migration.