This project is an ERP (Enterprise resource planning) system for the people at Velafrica ( http://velafrica.ch ). It consists of different modules, all serving the purpose to manage specific processes and teams inside Velafrica.
TODO: docker instructions
We are using zest.releaser for version management.
https://zestreleaser.readthedocs.io/
Commands:
- prerelease
- release
- postrelease
- fullrelease
- macOS:
brew install python3
- Windows: download installer from https://www.python.org/downloads/release/python-361/
- macOs:
- Windows:
pip install pipenv
We use Weasyprint to generate PDF files. Follow the installation instructions here: https://weasyprint.readthedocs.io/en/latest/install.html#
Weasyprint itself will be installed using pipenv in "Getting started".
-
macOs:
brew install cairo pango gdk-pixbuf libffi
If there are permission errors, make sure to give your user write access on /usr/local
sudo chown -R $(whoami) /usr/local/*
- postgresql (9.4)
node (5.5): https://nodejs.org/download/release/v5.5.0/
https://devcenter.heroku.com/articles/heroku-command-line#download-and-install
NOTE: Before we were using virtualenv, but we migrated to pipenv recently, since it is easier to use and better supported by IDEs.
pipenv install --python 3.6
This creates a virtual environment.
pipenv shell
cp .env_dist .env
Fill in your database credentials (eg. username, password & database name) in .env
, by modifying the following entry:
DATABASE_URL=postgres://your-username:your-password@localhost:5432/velafrica_dev
heroku local:run python manage.py migrate
heroku local:run python manage.py compilemessages
heroku local:run ./bin/load_fixtures.sh
heroku local:start -f Procfile_dev
open http://localhost:8000/
# Export database to file
pg_dump -U <your-username> velafrica_dev > dbexport.pgsql
# Import database form file
psql -U <your-username> velafrica_dev < dbexport.pgsql
# Extract translations from the templates & code into a .po file
python manage.py makemessages -a \
-i node_modules \
-i staticfiles \
-i tmp \
-i venv
The instructions here are meant for a fresh deployment to heroku. For consecutive deployments, heroku and github are currently set up in a way that successful builds of the master
branch trigger a deployment to heroku. The current configuration (npm run postinstall
& the heroku release commands) make sure that the assets are being compiled and the schema migrations are applied.
# Create a new heroku application
heroku create <your-app-name> --region=eu
# Add a postgresql database
heroku addons:create heroku-postgresql:hobby-dev --app <your-app-name>
# Add rollbar to log errors in production
heroku addons:create rollbar:free --app <your-app-name>
# Set the debugging to false, to make sure we're not leaking information to the user in case of an error
heroku config:set DEBUG=False --app <your-app-name>
# Make sure all the required buildpacks are defined and the order is the same.
open https://dashboard.heroku.com/apps/<your-app-name>/settings
1st buildpack: https://github.com/heroku/heroku-buildpack-addon-wait
2nd buildpack: https://github.com/philippkueng/heroku-buildpack-sassc
3rd buildpack: heroku/nodejs
4th buildpack: heroku/python
# The deploy the code for the first time.
git push heroku master
# (Optional) setup automatic deployments
open https://dashboard.heroku.com/apps/<your-app-name>/deploy/github
To update / save new fixtures run
heroku local:run python manage.py dumpdata --format=json --indent=2 -v 2 [app_name] | grep -v "Loaded ENV .env" > fixtures/[app_name].json
or for specific models:
heroku local:run python manage.py dumpdata --format=json --indent=2 -v 2 [app_name.model] | grep -v "Loaded ENV .env" > fixtures/[app_name.model].json
Before you commit the new fixtures file, make sure you remove dev/test data from the json and only commit those changes which are relevant for staging or production
Most of the classes should be documented. More documentation is available per request (chregi.glatthard (at) gmail.com).