3.6 KiB
Development environment
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.10+, 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.
- This is necessary if
Installation
-
Install pipenv per Installing pipenv
-
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. -
Installed Node 18.x (if necessary)
nvm install 18
-
Activate Node 18.x
nvm use
-
Install Gulp CLI
npm install -g gulp-cli
-
Install required Node packages
npm install
-
Set, at least, the
DJANGO_SETTINGS_MODULE
environment variableexport 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.
-
Migrate the database
gulp migrate
-
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/
- Install devenv (linux/mac/windows subsystem for linux/docker) via https://devenv.sh/getting-started/
- git clone the repo
- here you have two options
- run
devenv shell
and then rungulp
- OR run
devenv up
which automatically runs gulp/nodejs/python as well
- run
- Open http://127.0.0.1:8000 and log in with the default
username and password (
admin
/admin
).
Devenv also generates the .devcontainer for vscode, and sets up github codespaces support. To run babybuddy in the devcontainer or codespaces, open a terminal after opening this repo in the devcontainer, which causes the dependencies to be installed via devenv shell
. Then, run gulp
to start the baby buddy server.
Debugging in devenv + vscode
To debug in devenv + vscode/codespaces:
- add a
.vscode/launch.json
file like this:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"env": {
"DEBUG": "False"
},
"args": [
"runserver"
],
"django": true,
"justMyCode": true
}
]
}
- Consider running
gulp fake --children 5 --days 7
as explained in the gulp command reference to add some fake data to the database - Click Run -> Start Debugging (F5) and set your breakpoints in the python as desired