git clone https://github.com/gitcoinco/web.git
cd web
cp app/app/local.env app/app/.env
docker-compose up -d --build
docker-compose up --build
Actively follow a container's log:
docker-compose logs -f web # Or any other container name
View all container logs:
docker-compose logs
Navigate to http://localhost:8000/
.
Note: Running docker-compose logs --tail=50 -f <optional container_name>
will follow all container output in the active terminal window, while specifying a container name will follow that specific container's output. --tail
is optional.
Check out the Docker Compose CLI Reference for more information.
You will need to edit the app/.env
file with your local environment variables. Look for config items that are marked # required
.
If you plan on using the Github integration, please read the third party integration guide.
If you're testing in a staging or production style environment behind a CDN, pass the DJANGO_STATIC_HOST
environment variable to your django web instance specifying the CDN URL.
For example:
DJANGO_STATIC_HOST='https://gitcoin.co
docker-compose exec web python3 app/manage.py createsuperuser
This can be useful if you'd like data to test with:
docker-compose exec web python3 app/manage.py sync_geth
or equivalently:
docker-compose exec web python3 app/manage.py sync_geth rinkeby 402 99999999999
Q: How can I run the tests locally?
You can ensure your project will pass all Travis tests by running:
make tests # docker-compose exec -e DJANGO_SETTINGS_MODULE=app.settings web pytest -p no:ethereum; npm run eslint;
The above make command will run eslint
and pytest
.
Q: My environment is erroring out due to missing modules/packages or postgresql errors. How can I fix it?
make fresh # docker-compose down -v; docker-compose up -d --build;
Q: How can I access the django administration login?
make superuser # docker-compose exec web python3 app/manage.py createsuperuser
open http://localhost:8000/_administration
Q: How can I attempt automatic remediation of eslint and isort test failures?
make fix # npm run eslint:fix; docker-compose exec web isort -rc --atomic .;
Q: How can I see a complete list of Makefile commands and descriptions?
make # make help
Q: How can I enable the Github Login functionality on my local docker instance?
If you plan on using the Github integration, please read the third party integration guide.
Q: what's the best way to import ipdb; ipdb.set_trace() a HTTP request via docker?
Add import ipdb;ipdb.set_trace()
to the method you want to inspect, you then run: make get_ipdb_shell
to drop into the active shell for inspection.
Q: How can I access the Django shell, similar to: python manage.py shell ?
Simply run: make get_django_shell
or docker-compose exec web python app/manage.py shell
Q: I want to inspect or manipulate the container via bash. How can I access the root shell of the container?
Run: docker-compose exec web bash