/backend

Backend written in Django for Cynthesize

Primary LanguagePythonOtherNOASSERTION

Cynthesize

Django Backend

Join the chat at https://gitter.im/oppia/oppia-chat

Setting up PostgreSQL

Django version

This project will focus on Django 2.0.7.

Getting started (Windows):

  1. Install Python 3.6.
  2. Clone this repository or download the zip
    git clone https://github.com/Cynthesize/backend/
  3. Make sure you're in the directory you just created:
    cd backend
  4. Create a Python venv:
    virtualenv .venv
  5. Activate the venv:
    "source .venv/bin/activate"
  6. Install Python requirements:
    pip install -r requirements.txt
  7. Move to source directory:
    cd src/
  8. Set required environment variables:
    export POSTGRESQL_ADDON_DB='<DB_NAME>'
    export POSTGRESQL_ADDON_HOST='<DB_HOST>'
    export POSTGRESQL_ADDON_PASSWORD='<DB_PASSWORD>'
    export POSTGRESQL_ADDON_PORT='<DB_PORT>'
    export POSTGRESQL_ADDON_USER='<DB_USER>'
    export DJANGO_SECRET='<YOUR_DJANGO_SECRET>'
  9. Migrate models to database and Collect static files:
    python manage.py makemigrations users
    python manage.py makemigrations ideas
    python manage.py migrate users
    python manage.py migrate ideas
    python manage.py collectstatic
  10. Run development server:
    python manage.py runserver <PORT_NUMBER>

Deploy (Docker):

Required environment variables:

  POSTGRESQL_ADDON_DB='<DB_NAME>'
  POSTGRESQL_ADDON_HOST='<DB_HOST>'
  POSTGRESQL_ADDON_PASSWORD='<DB_PASSWORD>'
  POSTGRESQL_ADDON_PORT='<DB_PORT>'
  POSTGRESQL_ADDON_USER='<DB_USER>'
  DJANGO_SECRET='<YOUR_DJANGO_SECRET>'

See Dockerfile for details.

License

This project follows the GNU GPLv3. See the LICENSE for details.