[go: up one dir, main page]

Skip to content

Polyculture forest modelling using Python and Django.

License

Notifications You must be signed in to change notification settings

dsrp/treesandpeople

Repository files navigation

treesandpeople

Polyculture forrest modelling using Python and Django.

Requirements

Getting started

This is a standard Django 2 project, using pipenv to manage dependencies.

  1. Clone the project with Git: git clone https://github.com/dsrp/treesandpeople.git

  2. Install project dependencies: pipenv install (from project directory)

  3. Activate environment: pipenv shell

  4. Create Postgres user and database:

    $ createuser treesandpeople
    $ createdb -O treesandpeople -E UTF-8 treesandpeople

    Warning: in production SET A PASSWORD!

  5. (Temporarily) create migrations: ./manage.py makemigrations

  6. Populate the database: ./manage.py migrate

  7. Create superuser admin account: ./manage.py createsuperuser

  8. Start development server: ./manage.py runserver

  9. Navigate to http://127.0.0.1:8000/admin/ and have fun!

Updating

How to fetch changes from upstream.

  1. Fetch changes in code: git pull
  2. Execute pending migrations: ./manage.py migrate

Production

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

Releases

No releases published

Packages

No packages published