- Inside the
backend
folder, do the following: - Create a copy of
unboxxen/settings/local.py.example
:
cp unboxxen/settings/local.py.example unboxxen/settings/local.py
- Create a copy of
.env.example
:cp .env.example .env
- Create the migrations for
users
app:python manage.py makemigrations
- Run the migrations:
python manage.py migrate
- Create the migrations for
users
app:
docker-compose run --rm backend python manage.py makemigrations
- Run the migrations:
docker-compose run --rm backend python manage.py migrate
- Setup editorconfig, prospector and ESLint in the text editor you will use to develop.
- Open a command line window and go to the project's directory.
pip install -r requirements.txt && pip install -r dev-requirements.txt
npm install
npm run start
- Open another command line window and go to the
backend
directory. workon theprojectname
orsource theprojectname/bin/activate
depending on if you are using virtualenvwrapper or just virtualenv.python manage.py runserver
- Open a command line window and go to the project's directory.
docker-compose up -d
To access the logs for each service rundocker-compose logs -f service_name
(either backend, frontend, etc)
- Open a command line window and go to the project's directory
workon theprojectname
orsource theprojectname/bin/activate
depending on if you are using virtualenvwrapper or just virtualenv.python manage.py celery
make test
Will run django tests using --keepdb
and --parallel
. You may pass a path to the desired test module in the make command. E.g.:
make test someapp.tests.test_views
This project comes with an app.json
file, which can be used to create an app on Heroku from a GitHub repository.
After setting up the project, you can init a repository and push it on GitHub. If your repository is public, you can use the following button:
If you are in a private repository, access the following link replacing $YOUR_REPOSITORY_LINK$
with your repository link.
https://heroku.com/deploy?template=$YOUR_REPOSITORY_LINK$
Remember to fill the ALLOWED_HOSTS
with the URL of your app, the default on heroku is appname.herokuapp.com
. Replace appname
with your heroku app name.
Sentry is already set up on the project. For production, add SENTRY_DSN
environment variable on Heroku, with your Sentry DSN as the value.
You can test your Sentry configuration by deploying the boilerplate with the sample page and clicking on the corresponding button.
The bin/post_compile
script has a step to push Javascript source maps to Sentry, however some environment variables need to be set on Heroku.
You need to enable Heroku dyno metadata on your Heroku App. Use the following command on Heroku CLI:
heroku labs:enable runtime-dyno-metadata -a <app name>
The environment variables that need to be set are:
SENTRY_ORG
- Name of the Sentry Organization that owns your Sentry Project.SENTRY_PROJECT_NAME
- Name of the Sentry Project.SENTRY_API_KEY
- Sentry API key that needs to be generated on Sentry. You can find or create authentication tokens within Sentry.
After enabling dyno metadata and setting the environment variables, your next Heroku Deploys will create a release on Sentry where the release name is the commit SHA, and it will push the source maps to it.
- Manually with
prospector
andnpm run lint
on project root. - During development with an editor compatible with prospector and ESLint.
- Run
pre-commit install
to enable the hook into your git repo. The hook will run automatically for each commit. - Run
git commit -m "Your message" -n
to skip the hook if you need.
Some settings defaults were decided based on Vinta's experiences. Here's the rationale behind them:
We believe Celery tasks should be idempotent. So for us it's safe to set CELERY_ACKS_LATE = True
to ensure tasks will be re-queued after a worker failure. Check Celery docs on "Should I use retry or acks_late?" for more info.