mybuddy/docs/contributing/development-environment.md

2.4 KiB

Development environment

Gitpod ready-to-code

Click the Gitpod badge to open a new development environment in Gitpod or use the information and steps below to set up a local development environment for Baby Buddy.

Requirements

  • Python 3.8+, pip, pipenv
  • NodeJS 18.x and NPM 8.x (NVM recommended)
  • Gulp
  • Possibly libpq-dev
    • This is necessary if psycopg2 can't find an appropriate prebuilt binary.

Installation

  1. Install pipenv per Installing pipenv

  2. Install required Python packages, including dev packages

    pipenv install --three --dev
    

    If this fails, install libpq-dev (e.g. sudo apt install libpq-dev) and try again.

  3. Installed Node 18.x (if necessary)

    nvm install 18
    
  4. Activate Node 18.x

    nvm use
    
  5. Install Gulp CLI

    npm install -g gulp-cli
    
  6. Install required Node packages

    npm install
    
  7. Set, at least, the DJANGO_SETTINGS_MODULE environment variable

    export DJANGO_SETTINGS_MODULE=babybuddy.settings.development
    

    This process will differ based on the host OS. The above example is for Linux-based systems. See Configuration for other settings and methods for defining them.

  8. Migrate the database

    gulp migrate
    
  9. Build assets and run the server

    gulp
    

    This command will also watch for file system changes to rebuild assets and restart the server as needed.

Open http://127.0.0.1:8000 and log in with the default username and password (admin/admin).

Alternative: https://devenv.sh/

  1. Install devenv (linux/mac/windows subsystem for linux/docker) via https://devenv.sh/getting-started/
  2. git clone the repo
  3. run devenv shell
  4. Open http://127.0.0.1:8000 and log in with the default username and password (admin/admin).

This method also lets you generate a docker image from your devenv afterwards using devenv container shell https://devenv.sh/containers/ . You can run this docker development image using devenv container shell --docker-run

devenv also generates the devcontainer for vscode