The root of all messaging.
One time setup of your environment and database:
SECRET_KEY
setDATABASE_URL=postgres://snippets:snippets@db:5432/snippets
PROD_DETAILS_DIR
set to a writeable path, eg PROD_DETAILS_DIR=/home/webdev/
$ docker-compose run --service-ports web bash
[docker]$ ./manage.py update_product_details
[docker]$ ./manage.py migrate
[docker]$ ./manage.py createsuperuser
(enter any user/email/pass you wish. Email is not required.)[docker]$ ./manage.py shell -c 'from snippets.base.util import *; create_countries();'
Start the development server:
[docker]$ ./bin/run-dev.sh
https://localhost:8443/admin
and log in with the admin account created in step #4. See an TLS Security Exception? Go to TLS Certifcates section.run
instead of up
docker-compose run
is more suitable for development purposes since you get a
shell and from there you can run the webserver command. This way you can debug
using set_trace()
or restart the server when things go bad. The trick here is
to use --service-ports
flag to make docker compose map the required ports.
The project is configured for docker-compose up
if that's your preference.
Firefox communicates with the snippets service only over secure HTTPS
connections. For development, the runserver_plus
command as executed in
./bin/run-dev.sh
generates and uses a self-signed certificate.
You'll need to permanently accept the certificate, to allow Firefox to fetch Snippets from your development environment.
$ ./manage.py test --parallel
To rebuild your docker compose environment, first remove current images and
containers and then run the build
command.
$ docker-compose kill
$ docker-compose rm -f
$ docker-compose build
Therapist is a smart pre-commit hook for git to ensure that committed code has been properly linted.
Install the hooks by running:
$ therapist install