Skip to content

Latest commit

 

History

History
47 lines (36 loc) · 1.82 KB

README.md

File metadata and controls

47 lines (36 loc) · 1.82 KB

This is the Django web app for CGRAN.org

The information in the main table is automatically generated by parsing gr-recipes and gr-etcetera (PyBOMBS recipes).

To Install

  • clone this repo
  • install docker
  • rename settings_secret.py.template to settings_secret.py and change the value of the secret key to something else (anything else)
  • create a cronjob on the server running the docker container
    1. crontab -e
    2. 0 1 * * * docker exec -ti cgran_cgran_web_1 /bin/sh -c "python manage.py refresh"
  • To run locally for dev-
    • in settings.py swap the DATABASES to the commented out one, and set ALLOWED_HOSTS = ['*']
    • python manage.py migrate
    • python manage.py makemigrations
    • python manage.py migrate
    • python manage.py refresh
    • python manage.py runserver
    • open browser to http://127.0.0.1:8000

To launch app with docker

docker-compose up --build --no-deps

or

docker-compose up

Refresh database with: python manage.py refresh

Tips/tricks

  • For shell accessing- docker exec -ti nginx bash or docker exec -ti web bash
  • docker ps lists docker containers that are running
  • docker ps -a lists all built containers
  • you can stop and remove all docker containers using docker stop $(docker ps -a -q) then docker rm $(docker ps -a -q)
  • three-step guide to making model changes:
    1. Change your models (in models.py).
    2. Run python manage.py makemigrations to create migrations for those changes
    3. Run python manage.py migrate to apply those changes to the database.
  • save db to yaml file- python manage.py dumpdata --format yaml ootlist.Outoftreemodule -o db.yaml
  • load yaml file to db- python manage.py loaddata db.yaml