2022-02-21 19:13:56 +00:00
|
|
|
# Development environment
|
|
|
|
|
|
|
|
[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/babybuddy/babybuddy)
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2024-01-14 04:22:08 +00:00
|
|
|
- Python 3.10+, pip, pipenv
|
2023-03-18 17:02:07 +00:00
|
|
|
- NodeJS 18.x and NPM 8.x (NVM recommended)
|
2022-02-21 19:13:56 +00:00
|
|
|
- Gulp
|
|
|
|
- Possibly `libpq-dev`
|
|
|
|
- This is necessary if `psycopg2` can't find an appropriate prebuilt binary.
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
2023-06-24 02:56:02 +00:00
|
|
|
1. Install pipenv per [Installing pipenv](https://pipenv.pypa.io/en/latest/installation/)
|
2022-02-21 19:13:56 +00:00
|
|
|
|
|
|
|
1. Install required Python packages, including dev packages
|
|
|
|
|
2024-02-07 06:04:17 +00:00
|
|
|
```shell
|
|
|
|
pipenv install --three --dev
|
|
|
|
```
|
2023-09-17 01:09:46 +00:00
|
|
|
|
2024-02-07 06:04:17 +00:00
|
|
|
If this fails, install `libpq-dev` (e.g. `sudo apt install libpq-dev`) and try again.
|
2023-09-17 01:09:46 +00:00
|
|
|
|
2023-03-18 17:02:07 +00:00
|
|
|
1. Installed Node 18.x (if necessary)
|
2022-02-21 19:13:56 +00:00
|
|
|
|
2024-02-07 06:04:17 +00:00
|
|
|
```shell
|
|
|
|
nvm install 18
|
|
|
|
```
|
2022-02-21 19:13:56 +00:00
|
|
|
|
2023-03-18 17:02:07 +00:00
|
|
|
1. Activate Node 18.x
|
2022-02-21 19:13:56 +00:00
|
|
|
|
2024-02-07 06:04:17 +00:00
|
|
|
```shell
|
|
|
|
nvm use
|
|
|
|
```
|
2022-02-21 19:13:56 +00:00
|
|
|
|
|
|
|
1. Install Gulp CLI
|
|
|
|
|
2024-02-07 06:04:17 +00:00
|
|
|
```shell
|
|
|
|
npm install -g gulp-cli
|
|
|
|
```
|
2022-02-21 19:13:56 +00:00
|
|
|
|
|
|
|
1. Install required Node packages
|
|
|
|
|
2024-02-07 06:04:17 +00:00
|
|
|
```shell
|
|
|
|
npm install
|
|
|
|
```
|
2022-02-21 19:13:56 +00:00
|
|
|
|
|
|
|
1. Set, at least, the `DJANGO_SETTINGS_MODULE` environment variable
|
|
|
|
|
2024-02-07 06:04:17 +00:00
|
|
|
```shell
|
|
|
|
export DJANGO_SETTINGS_MODULE=babybuddy.settings.development
|
|
|
|
```
|
2023-09-17 01:09:46 +00:00
|
|
|
|
2024-02-07 06:04:17 +00:00
|
|
|
This process will differ based on the host OS. The above example is for
|
|
|
|
Linux-based systems. See [Configuration](../configuration/intro.md) for other
|
|
|
|
settings and methods for defining them.
|
2022-02-21 19:13:56 +00:00
|
|
|
|
|
|
|
1. Migrate the database
|
|
|
|
|
2024-02-07 06:04:17 +00:00
|
|
|
```shell
|
|
|
|
gulp migrate
|
|
|
|
```
|
2022-02-21 19:13:56 +00:00
|
|
|
|
|
|
|
1. Build assets and run the server
|
|
|
|
|
2024-02-07 06:04:17 +00:00
|
|
|
```shell
|
|
|
|
gulp
|
|
|
|
```
|
2022-02-21 19:13:56 +00:00
|
|
|
|
2024-02-07 06:04:17 +00:00
|
|
|
This command will also watch for file system changes to rebuild assets and
|
|
|
|
restart the server as needed.
|
2022-02-21 19:13:56 +00:00
|
|
|
|
|
|
|
Open [http://127.0.0.1:8000](http://127.0.0.1:8000) and log in with the default
|
|
|
|
username and password (`admin`/`admin`).
|
2023-09-17 01:09:46 +00:00
|
|
|
|
2024-04-14 04:10:45 +00:00
|
|
|
## Alternative: [Dev Container](https://containers.dev/)
|
2023-09-17 01:09:46 +00:00
|
|
|
|
2024-04-14 04:10:45 +00:00
|
|
|
1. Add Dev Container support to your preferred IDE: https://containers.dev/supporting
|
|
|
|
2. Clone the Baby Buddy repo
|
|
|
|
3. Open the cloned repo in the dev container
|
2023-09-17 01:09:46 +00:00
|
|
|
|
2024-04-14 04:10:45 +00:00
|
|
|
Run `gulp` to start the Baby Buddy development server.
|
2023-09-30 18:57:34 +00:00
|
|
|
|
2024-04-14 04:10:45 +00:00
|
|
|
### Debugging in VSCode
|
2024-02-07 06:04:17 +00:00
|
|
|
|
2023-09-30 18:57:34 +00:00
|
|
|
To debug in devenv + vscode/codespaces:
|
|
|
|
|
2024-04-14 04:10:45 +00:00
|
|
|
1. Copy `.vscode/launch.template.json` as `.vscode/launch.json` file like this:
|
|
|
|
2. Click Run -> Start Debugging (F5) and set your breakpoints in the python as desired
|