Polyculture forrest modelling using Python and Django.
This is a standard Django 2 project, using pipenv to manage dependencies.
-
Clone the project with Git:
git clone https://github.com/dsrp/treesandpeople.git
-
Install project dependencies:
pipenv install
(from project directory) -
Activate environment:
pipenv shell
-
Create Postgres user and database:
$ createuser treesandpeople $ createdb -O treesandpeople -E UTF-8 treesandpeople
Warning: in production SET A PASSWORD!
-
(Temporarily) create migrations:
./manage.py makemigrations
-
Populate the database:
./manage.py migrate
-
Create superuser admin account:
./manage.py createsuperuser
-
Start development server:
./manage.py runserver
-
Navigate to
http://127.0.0.1:8000/admin/
and have fun!
How to fetch changes from upstream.
- Fetch changes in code:
git pull
- Execute pending migrations:
./manage.py migrate
By default, this project uses Gunicorn, Whitenoise and django-environ to deploy, greatly simplifying matters.
You'll have to set the following environment variables:
DJANGO_SETTINGS_MODULE="treesandpeople.settings.production"
DJANGO_SECRET_KEY
: generate using./manage.py generate_secret_key
DATABASE_URL
Collect static files, prepare database:
pipenv run ./manage.py migrate
pipenv run ./manage.py collectstatic
Then, simply run it with:
pipenv run gunicorn treesandpeople.wsgi