lint: add markdown and yaml to prettier

This commit is contained in:
billybonks 2024-02-07 14:04:17 +08:00 committed by Christopher Charbonneau Wells
parent dda68e0fc3
commit 2d1338a915
29 changed files with 4171 additions and 4171 deletions

View File

@ -2,11 +2,11 @@ name: Setup
description: Set up Baby Buddy environment and dependencies. description: Set up Baby Buddy environment and dependencies.
inputs: inputs:
python-version: python-version:
description: 'What Python version to use.' description: "What Python version to use."
required: false required: false
default: '3.x' default: "3.x"
runs: runs:
using: 'composite' using: "composite"
steps: steps:
- name: Install Pipenv - name: Install Pipenv
shell: bash shell: bash
@ -15,8 +15,8 @@ runs:
id: setup-python id: setup-python
with: with:
python-version: ${{ inputs.python-version }} python-version: ${{ inputs.python-version }}
cache: 'pipenv' cache: "pipenv"
cache-dependency-path: 'requirements.txt' cache-dependency-path: "requirements.txt"
- name: Install Python dependencies - name: Install Python dependencies
shell: bash shell: bash
run: pipenv install --dev run: pipenv install --dev

View File

@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
python-version: [ '3.10', '3.11', '3.12' ] python-version: ["3.10", "3.11", "3.12"]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: ./.github/actions/setup - uses: ./.github/actions/setup
@ -71,5 +71,5 @@ jobs:
- name: Push to dokku - name: Push to dokku
uses: dokku/github-action@master uses: dokku/github-action@master
with: with:
git_remote_url: 'ssh://dokku@dokku.baby-buddy.net:22/demo' git_remote_url: "ssh://dokku@dokku.baby-buddy.net:22/demo"
ssh_private_key: ${{ secrets.DOKKU_SSH_PRIVATE_KEY }} ssh_private_key: ${{ secrets.DOKKU_SSH_PRIVATE_KEY }}

View File

@ -7,7 +7,7 @@ on:
branches: branches:
- master - master
schedule: schedule:
- cron: '33 0 * * 3' - cron: "33 0 * * 3"
jobs: jobs:
analyze: analyze:
name: Analyze name: Analyze
@ -19,13 +19,13 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
language: [ 'javascript', 'python' ] language: ["javascript", "python"]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: github/codeql-action/init@v3 - uses: github/codeql-action/init@v3
with: with:
config-file: ./.github/codeql/codeql-config.yml config-file: ./.github/codeql/codeql-config.yml
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
setup-python-dependencies: false setup-python-dependencies: false
- uses: ./.github/actions/setup - uses: ./.github/actions/setup
- uses: github/codeql-action/analyze@v3 - uses: github/codeql-action/analyze@v3

View File

@ -1,6 +1,6 @@
name: "Review app" name: "Review app"
env: env:
DOKKU_GIT_REMOTE_URL: 'ssh://dokku@dokku.baby-buddy.net:22' DOKKU_GIT_REMOTE_URL: "ssh://dokku@dokku.baby-buddy.net:22"
on: on:
pull_request: pull_request:
types: [labeled, unlabeled] types: [labeled, unlabeled]

View File

@ -2,7 +2,4 @@ vendor
**/static **/static
*.html *.html
*.css *.css
*.md
*.yaml
*.yml
*.scss *.scss

View File

@ -11,7 +11,7 @@
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
A buddy for babies! Helps caregivers track sleep, feedings, diaper changes, A buddy for babies! Helps caregivers track sleep, feedings, diaper changes,
tummy time and more to learn about and predict baby's needs without (*as much*) tummy time and more to learn about and predict baby's needs without (_as much_)
guess work. guess work.
![Baby Buddy desktop view](screenshot.png) ![Baby Buddy desktop view](screenshot.png)
@ -56,7 +56,7 @@ for information about how to create/update translations.
:uk: English (U.K.) :uk: English (U.K.)
:us: English (U.S.) *(base)* :us: English (U.S.) _(base)_
:finland: Finnish :finland: Finnish

View File

@ -11,7 +11,6 @@ currently being supported with security updates.
## Reporting a Vulnerability ## Reporting a Vulnerability
Baby Buddy's maintainers recommend huntr.dev as a platform for reporting Baby Buddy's maintainers recommend huntr.dev as a platform for reporting
vulnerabilities. Maintainers will do their best to verify, respond to vulnerabilities. Maintainers will do their best to verify, respond to
and fix issues reported on the platform. and fix issues reported on the platform.

View File

@ -67,10 +67,10 @@ curl -X GET 'https://[...]/api/changes/?limit=5&offset=10' -H 'Authorization: To
```json ```json
{ {
"count": 20, "count": 20,
"next": "https://[...]/api/changes/?limit=5&offset=15", "next": "https://[...]/api/changes/?limit=5&offset=15",
"previous": "https://[...]/api/changes/?limit=5&offset=5", "previous": "https://[...]/api/changes/?limit=5&offset=5",
"results": [] "results": []
} }
``` ```
@ -86,12 +86,12 @@ curl -X GET https://[...]/api/children/gregory-hill/ -H 'Authorization: Token [.
```json ```json
{ {
"id":3, "id": 3,
"first_name":"Gregory", "first_name": "Gregory",
"last_name":"Hill", "last_name": "Hill",
"birth_date":"2020-02-11", "birth_date": "2020-02-11",
"slug":"gregory-hill", "slug": "gregory-hill",
"picture":null "picture": null
} }
``` ```
@ -101,12 +101,12 @@ curl -X GET https://[...]/api/sleep/1/ -H 'Authorization: Token [...]'
```json ```json
{ {
"id":480, "id": 480,
"child":3, "child": 3,
"start":"2020-03-12T21:25:28.916016-07:00", "start": "2020-03-12T21:25:28.916016-07:00",
"end":"2020-03-13T01:34:28.916016-07:00", "end": "2020-03-13T01:34:28.916016-07:00",
"duration":"04:09:00", "duration": "04:09:00",
"nap":false "nap": false
} }
``` ```
@ -123,7 +123,7 @@ Returns JSON data in the response body in the following format:
} }
``` ```
- `count`: Total number of records (*in the database*, not just the response). - `count`: Total number of records (_in the database_, not just the response).
- `next`: URL for the next set of results. - `next`: URL for the next set of results.
- `previous`: URL for the previous set of results. - `previous`: URL for the previous set of results.
- `results`: An array of the results of the request. - `results`: An array of the results of the request.
@ -192,7 +192,7 @@ formats.
`POST` requests also accept a `timer` field to model endpoints supporting duration `POST` requests also accept a `timer` field to model endpoints supporting duration
(Feeding, Sleep, Tummy Time). Set `timer` to a valid timer ID in a request instead of (Feeding, Sleep, Tummy Time). Set `timer` to a valid timer ID in a request instead of
the `start` and `end` fields. The new entry will use the `start` and `end` values the `start` and `end` fields. The new entry will use the `start` and `end` values
*from the Timer* and if the timer is running it will be stopped by this operation. _from the Timer_ and if the timer is running it will be stopped by this operation.
Additionally, if the Timer has a child relationship, the `child` field will be Additionally, if the Timer has a child relationship, the `child` field will be
filled in automatically with the `child` value from the Timer. filled in automatically with the `child` value from the Timer.
@ -201,7 +201,7 @@ The `timer` field will **always override** the relevant fields (`child`, `start`
and `end`) on the request. E.g., a `POST` request with both the `timer` and `end` and `end`) on the request. E.g., a `POST` request with both the `timer` and `end`
fields will ignore the `end` field value and replace it with the Timer's `end` fields will ignore the `end` field value and replace it with the Timer's `end`
value. The same applies for `start` and `child`. These fields are all **required** value. The same applies for `start` and `child`. These fields are all **required**
if the `timer` field is *not* set. if the `timer` field is _not_ set.
#### Example `timer` field usage #### Example `timer` field usage
@ -218,12 +218,12 @@ Note the timer `id` in the response:
```json ```json
{ {
"id": 5, "id": 5,
"child": 1, "child": 1,
"name": null, "name": null,
"start": "2022-05-28T19:59:40.013914Z", "start": "2022-05-28T19:59:40.013914Z",
"duration": null, "duration": null,
"user": 1 "user": 1
} }
``` ```
@ -240,13 +240,13 @@ Note that `child` and `start` match the timer values (and `end` is auto-populate
```json ```json
{ {
"id": 162, "id": 162,
"child": 1, "child": 1,
"start": "2022-05-28T19:59:40.013914Z", "start": "2022-05-28T19:59:40.013914Z",
"end": "2022-05-28T20:01:13.549099Z", "end": "2022-05-28T20:01:13.549099Z",
"duration": "00:01:33.535185", "duration": "00:01:33.535185",
"milestone": "", "milestone": "",
"tags": [] "tags": []
} }
``` ```

View File

@ -2,16 +2,16 @@
## `DEBUG` ## `DEBUG`
*Default:* `False` _Default:_ `False`
When in debug mode, Baby Buddy will print much more detailed error information When in debug mode, Baby Buddy will print much more detailed error information
for exceptions. This setting should be *False* in production deployments. for exceptions. This setting should be _False_ in production deployments.
See also [Django's documentation on the DEBUG setting](https://docs.djangoproject.com/en/5.0/ref/settings/#debug). See also [Django's documentation on the DEBUG setting](https://docs.djangoproject.com/en/5.0/ref/settings/#debug).
## `SUB_PATH` ## `SUB_PATH`
*Default:* `None` _Default:_ `None`
If Baby Buddy is hosted in a subdirectory of another server (e.g., `http://www.example.com/babybuddy`) If Baby Buddy is hosted in a subdirectory of another server (e.g., `http://www.example.com/babybuddy`)
this must be set to the subdirectory path (e.g., `/babybuddy`) for correct handling of this must be set to the subdirectory path (e.g., `/babybuddy`) for correct handling of
@ -22,7 +22,7 @@ details.
## `TIME_ZONE` ## `TIME_ZONE`
*Default:* `UTC` _Default:_ `UTC`
The default time zone to use for the instance. This value can be overridden per use from The default time zone to use for the instance. This value can be overridden per use from
the user settings form. the user settings form.

View File

@ -2,7 +2,7 @@
## `DB_ENGINE` ## `DB_ENGINE`
*Default:* `django.db.backends.sqlite3` _Default:_ `django.db.backends.sqlite3`
The database engine utilized for the deployment. The database engine utilized for the deployment.
@ -10,37 +10,37 @@ See also [Django's documentation on the ENGINE setting](https://docs.djangoproje
## `DB_HOST` ## `DB_HOST`
*Default:* unset _Default:_ unset
The name of the database host for the deployment. The name of the database host for the deployment.
## `DB_NAME` ## `DB_NAME`
*Default:* `BASE_DIR/data/db.sqlite3` _Default:_ `BASE_DIR/data/db.sqlite3`
The name of the database table utilized for the deployment. The name of the database table utilized for the deployment.
## `DB_PASSWORD` ## `DB_PASSWORD`
*Default:* unset _Default:_ unset
The password for the database user for the deployment. In the default example, The password for the database user for the deployment. In the default example,
this is the root PostgreSQL password. this is the root PostgreSQL password.
## `DB_PORT` ## `DB_PORT`
*Default:* unset _Default:_ unset
The listening port for the database. The default port for PostgreSQL is 5432. The listening port for the database. The default port for PostgreSQL is 5432.
## `DB_USER` ## `DB_USER`
*Default:* unset _Default:_ unset
The database username utilized for the deployment. The database username utilized for the deployment.
## `DB_OPTIONS` ## `DB_OPTIONS`
*Default:* unset _Default:_ unset
Additional options to pass to the database library. See the [Django Databases documentation](https://docs.djangoproject.com/en/5.0/ref/databases/) for examples. To enforce an SSL connection to the database, use `{'sslmode': 'require'}`. Additional options to pass to the database library. See the [Django Databases documentation](https://docs.djangoproject.com/en/5.0/ref/databases/) for examples. To enforce an SSL connection to the database, use `{'sslmode': 'require'}`.

View File

@ -2,51 +2,51 @@
## `EMAIL_HOST` ## `EMAIL_HOST`
*Default:* `None` _Default:_ `None`
The host to use for sending email. This must be set to enable SMTP email delivery. The host to use for sending email. This must be set to enable SMTP email delivery.
## `EMAIL_HOST_PASSWORD` ## `EMAIL_HOST_PASSWORD`
*Default:* (empty) _Default:_ (empty)
Password to use for the SMTP server defined in `EMAIL_HOST`. This setting is used in Password to use for the SMTP server defined in `EMAIL_HOST`. This setting is used in
conjunction with `EMAIL_HOST_USER` when authenticating to the SMTP server. conjunction with `EMAIL_HOST_USER` when authenticating to the SMTP server.
## `EMAIL_HOST_USER` ## `EMAIL_HOST_USER`
*Default:* (empty) _Default:_ (empty)
Username to use for the SMTP server defined in `EMAIL_HOST`. Username to use for the SMTP server defined in `EMAIL_HOST`.
## `EMAIL_PORT` ## `EMAIL_PORT`
*Default:* 25 _Default:_ 25
Port to use for the SMTP server defined in `EMAIL_HOST`. Port to use for the SMTP server defined in `EMAIL_HOST`.
## `EMAIL_USE_TLS` ## `EMAIL_USE_TLS`
*Default:* `False` _Default:_ `False`
Whether to use a TLS (secure) connection when talking to the SMTP server. Whether to use a TLS (secure) connection when talking to the SMTP server.
## `EMAIL_USE_SSL` ## `EMAIL_USE_SSL`
*Default:* `False` _Default:_ `False`
Whether to use an implicit TLS (secure) connection when talking to the SMTP server. Whether to use an implicit TLS (secure) connection when talking to the SMTP server.
## `EMAIL_SSL_KEYFILE` ## `EMAIL_SSL_KEYFILE`
*Default:* `None` _Default:_ `None`
f `EMAIL_USE_SSL` or `EMAIL_USE_TLS` is `True`, you can optionally specify the path to a f `EMAIL_USE_SSL` or `EMAIL_USE_TLS` is `True`, you can optionally specify the path to a
PEM-formatted certificate chain file to use for the SSL connection. PEM-formatted certificate chain file to use for the SSL connection.
## `EMAIL_SSL_CERTFILE` ## `EMAIL_SSL_CERTFILE`
*Default:* `None` _Default:_ `None`
If `EMAIL_USE_SSL` or `EMAIL_USE_TLS` is `True`, you can optionally specify the path to If `EMAIL_USE_SSL` or `EMAIL_USE_TLS` is `True`, you can optionally specify the path to
a PEM-formatted private key file to use for the SSL connection. a PEM-formatted private key file to use for the SSL connection.

View File

@ -2,7 +2,7 @@
## `ENABLE_HOME_ASSISTANT_SUPPORT` ## `ENABLE_HOME_ASSISTANT_SUPPORT`
*Default:* `False` _Default:_ `False`
This setting should be set to `True` if babybuddy is hosted through the [ingress This setting should be set to `True` if babybuddy is hosted through the [ingress
service of home assistant](https://developers.home-assistant.io/docs/add-ons/presentation/#ingress). service of home assistant](https://developers.home-assistant.io/docs/add-ons/presentation/#ingress).

View File

@ -2,10 +2,10 @@
## `ALLOWED_HOSTS` ## `ALLOWED_HOSTS`
*Default:* `*` (any host) _Default:_ `*` (any host)
Set this variable to a single host or comma-separated list of hosts without spaces. Set this variable to a single host or comma-separated list of hosts without spaces.
This should *always* be set to a specific host or hosts in production deployments. This should _always_ be set to a specific host or hosts in production deployments.
Do not include schemes ("http" or "https") with this setting. Do not include schemes ("http" or "https") with this setting.
@ -21,16 +21,17 @@ Do not include schemes ("http" or "https") with this setting.
## `CSRF_COOKIE_SECURE` ## `CSRF_COOKIE_SECURE`
*Default:* `False` _Default:_ `False`
If this is set to `True`, the browser CSRF cookie will be marked as "secure", which instructs the browser to only send the cookie over an HTTPS connection (never HTTP). If this is set to `True`, the browser CSRF cookie will be marked as "secure", which instructs the browser to only send the cookie over an HTTPS connection (never HTTP).
**See also** **See also**
- [Django's documentation on the `CSRF_COOKIE_SECURE` setting](https://docs.djangoproject.com/en/5.0/ref/settings/#csrf-cookie-secure) - [Django's documentation on the `CSRF_COOKIE_SECURE` setting](https://docs.djangoproject.com/en/5.0/ref/settings/#csrf-cookie-secure)
## `CSRF_TRUSTED_ORIGINS` ## `CSRF_TRUSTED_ORIGINS`
*Default:* `None` _Default:_ `None`
If Baby Buddy is behind a proxy, you may need add all possible origins to this setting If Baby Buddy is behind a proxy, you may need add all possible origins to this setting
for form submission to work correctly. Separate multiple origins with commas. for form submission to work correctly. Separate multiple origins with commas.
@ -49,12 +50,12 @@ Each entry must contain both the scheme (http, https) and fully-qualified domain
## `PROXY_HEADER` ## `PROXY_HEADER`
*Default:* `HTTP_REMOTE_USER` _Default:_ `HTTP_REMOTE_USER`
Sets the header to read the authenticated username from when Sets the header to read the authenticated username from when
`REVERSE_PROXY_AUTH` has been enabled. `REVERSE_PROXY_AUTH` has been enabled.
Baby Buddy modifies headers in the HTTP request; HTTP headers in the request have all characters converted to uppercase, replacing any hyphens with underscores and adding an HTTP_ prefix to the name. For example `X-Auth-User` would be converted to `HTTP_X_AUTH_USER`. Baby Buddy modifies headers in the HTTP request; HTTP headers in the request have all characters converted to uppercase, replacing any hyphens with underscores and adding an HTTP\_ prefix to the name. For example `X-Auth-User` would be converted to `HTTP_X_AUTH_USER`.
**Example value** **Example value**
@ -62,16 +63,17 @@ Baby Buddy modifies headers in the HTTP request; HTTP headers in the request hav
HTTP_X_AUTH_USER HTTP_X_AUTH_USER
**See also** **See also**
- [Django's documentation on the `REMOTE_USER` authentication method](https://docs.djangoproject.com/en/5.0/howto/auth-remote-user/) - [Django's documentation on the `REMOTE_USER` authentication method](https://docs.djangoproject.com/en/5.0/howto/auth-remote-user/)
- [Django's documentation on the request.META object](https://docs.djangoproject.com/en/5.0/ref/request-response/#django.http.HttpRequest.META) - [Django's documentation on the request.META object](https://docs.djangoproject.com/en/5.0/ref/request-response/#django.http.HttpRequest.META)
- [`REVERSE_PROXY_AUTH`](#reverse_proxy_auth) - [`REVERSE_PROXY_AUTH`](#reverse_proxy_auth)
## `REVERSE_PROXY_AUTH` ## `REVERSE_PROXY_AUTH`
*Default:* `False` _Default:_ `False`
Enable use of `PROXY_HEADER` to pass the username of an authenticated user. Enable use of `PROXY_HEADER` to pass the username of an authenticated user.
This setting should *only* be used with a properly configured reverse proxy to This setting should _only_ be used with a properly configured reverse proxy to
ensure the headers are not forwarded from sources other than your proxy. ensure the headers are not forwarded from sources other than your proxy.
**See also** **See also**
@ -80,7 +82,7 @@ ensure the headers are not forwarded from sources other than your proxy.
## `SECRET_KEY` ## `SECRET_KEY`
*Default:* `None` _Default:_ `None`
A random, unique string must be set as the "secret key" before Baby Buddy can A random, unique string must be set as the "secret key" before Baby Buddy can
be deployed and run. be deployed and run.
@ -89,7 +91,7 @@ See also [Django's documentation on the SECRET_KEY setting](https://docs.djangop
## `SECURE_PROXY_SSL_HEADER` ## `SECURE_PROXY_SSL_HEADER`
*Default:* `None` _Default:_ `None`
If Baby Buddy is behind a proxy, you may need to set this to `True` in order to If Baby Buddy is behind a proxy, you may need to set this to `True` in order to
trust the `X-Forwarded-Proto` header that comes from your proxy, and any time trust the `X-Forwarded-Proto` header that comes from your proxy, and any time
@ -104,9 +106,10 @@ came in via HTTPS).
## `SESSION_COOKIE_SECURE` ## `SESSION_COOKIE_SECURE`
*Default:* `False` _Default:_ `False`
If this is set to `True`, the browser session cookie will be marked as "secure", which instructs the browser to only send the cookie over an HTTPS connection (never HTTP). If this is set to `True`, the browser session cookie will be marked as "secure", which instructs the browser to only send the cookie over an HTTPS connection (never HTTP).
**See also** **See also**
- [Django's documentation on the `SESSION_COOKIE_SECURE` setting](https://docs.djangoproject.com/en/5.0/ref/settings/#session-cookie-secure) - [Django's documentation on the `SESSION_COOKIE_SECURE` setting](https://docs.djangoproject.com/en/5.0/ref/settings/#session-cookie-secure)

View File

@ -2,13 +2,13 @@
## `ALLOW_UPLOADS` ## `ALLOW_UPLOADS`
*Default:* `True` _Default:_ `True`
Whether to allow uploads (e.g., of Child photos). Whether to allow uploads (e.g., of Child photos).
## `AWS_ACCESS_KEY_ID` ## `AWS_ACCESS_KEY_ID`
*Default:* `None` _Default:_ `None`
Required to access your AWS S3 bucket, should be uniquely generated per bucket Required to access your AWS S3 bucket, should be uniquely generated per bucket
for security. for security.
@ -17,7 +17,7 @@ See also: [`AWS_STORAGE_BUCKET_NAME`](#aws_storage_bucket_name)
## `AWS_SECRET_ACCESS_KEY` ## `AWS_SECRET_ACCESS_KEY`
*Default:* `None` _Default:_ `None`
Required to access your AWS S3 bucket, should be uniquely generated per bucket Required to access your AWS S3 bucket, should be uniquely generated per bucket
for security. for security.
@ -26,14 +26,14 @@ See also: [`AWS_STORAGE_BUCKET_NAME`](#aws_storage_bucket_name)
## `AWS_STORAGE_BUCKET_NAME` ## `AWS_STORAGE_BUCKET_NAME`
*Default:* `None` _Default:_ `None`
If you would like to use AWS S3 for storage you will need to create a bucket and add If you would like to use AWS S3 for storage you will need to create a bucket and add
its name. See django-storages' [Amazon S3 documentation](https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html). its name. See django-storages' [Amazon S3 documentation](https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html).
## `AWS_S3_ENDPOINT_URL` ## `AWS_S3_ENDPOINT_URL`
*Default:* `None` _Default:_ `None`
Custom URL to use when connecting to S3, including scheme. Custom URL to use when connecting to S3, including scheme.
This allows to use a S3-compatible storage service of another provider than AWS. This allows to use a S3-compatible storage service of another provider than AWS.

View File

@ -19,60 +19,60 @@ information and steps below to set up a local development environment for Baby B
1. Install required Python packages, including dev packages 1. Install required Python packages, including dev packages
```shell ```shell
pipenv install --three --dev pipenv install --three --dev
``` ```
If this fails, install `libpq-dev` (e.g. `sudo apt install libpq-dev`) and try again. If this fails, install `libpq-dev` (e.g. `sudo apt install libpq-dev`) and try again.
1. Installed Node 18.x (if necessary) 1. Installed Node 18.x (if necessary)
```shell ```shell
nvm install 18 nvm install 18
``` ```
1. Activate Node 18.x 1. Activate Node 18.x
```shell ```shell
nvm use nvm use
``` ```
1. Install Gulp CLI 1. Install Gulp CLI
```shell ```shell
npm install -g gulp-cli npm install -g gulp-cli
``` ```
1. Install required Node packages 1. Install required Node packages
```shell ```shell
npm install npm install
``` ```
1. Set, at least, the `DJANGO_SETTINGS_MODULE` environment variable 1. Set, at least, the `DJANGO_SETTINGS_MODULE` environment variable
```shell ```shell
export DJANGO_SETTINGS_MODULE=babybuddy.settings.development export DJANGO_SETTINGS_MODULE=babybuddy.settings.development
``` ```
This process will differ based on the host OS. The above example is for This process will differ based on the host OS. The above example is for
Linux-based systems. See [Configuration](../configuration/intro.md) for other Linux-based systems. See [Configuration](../configuration/intro.md) for other
settings and methods for defining them. settings and methods for defining them.
1. Migrate the database 1. Migrate the database
```shell ```shell
gulp migrate gulp migrate
``` ```
1. Build assets and run the server 1. Build assets and run the server
```shell ```shell
gulp gulp
``` ```
This command will also watch for file system changes to rebuild assets and This command will also watch for file system changes to rebuild assets and
restart the server as needed. restart the server as needed.
Open [http://127.0.0.1:8000](http://127.0.0.1:8000) and log in with the default Open [http://127.0.0.1:8000](http://127.0.0.1:8000) and log in with the default
username and password (`admin`/`admin`). username and password (`admin`/`admin`).
@ -82,40 +82,41 @@ username and password (`admin`/`admin`).
1. Install devenv (linux/mac/windows subsystem for linux/docker) via https://devenv.sh/getting-started/ 1. Install devenv (linux/mac/windows subsystem for linux/docker) via https://devenv.sh/getting-started/
1. git clone the repo 1. git clone the repo
1. here you have two options 1. here you have two options
1. run `devenv shell` and then run `gulp` 1. run `devenv shell` and then run `gulp`
1. _OR_ run `devenv up` which automatically runs gulp/nodejs/python as well 1. _OR_ run `devenv up` which automatically runs gulp/nodejs/python as well
1. Open [http://127.0.0.1:8000](http://127.0.0.1:8000) and log in with the default 1. Open [http://127.0.0.1:8000](http://127.0.0.1:8000) and log in with the default
username and password (`admin`/`admin`). 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. 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 ### Debugging in devenv + vscode
To debug in devenv + vscode/codespaces: To debug in devenv + vscode/codespaces:
1. add a `.vscode/launch.json` file like this: 1. add a `.vscode/launch.json` file like this:
```json ```json
{ {
// Use IntelliSense to learn about possible attributes. // Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes. // Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
"name": "Python: Django", "name": "Python: Django",
"type": "python", "type": "python",
"request": "launch", "request": "launch",
"program": "${workspaceFolder}/manage.py", "program": "${workspaceFolder}/manage.py",
"env": { "env": {
"DEBUG": "False" "DEBUG": "False"
}, },
"args": [ "args": ["runserver"],
"runserver" "django": true,
], "justMyCode": true
"django": true, }
"justMyCode": true ]
}
]
} }
``` ```
2. Consider running `gulp fake --children 5 --days 7` as explained in the [gulp command reference](./gulp-command-reference.md) to add some fake data to the database 2. Consider running `gulp fake --children 5 --days 7` as explained in the [gulp command reference](./gulp-command-reference.md) to add some fake data to the database
3. Click Run -> Start Debugging (F5) and set your breakpoints in the python as desired 3. Click Run -> Start Debugging (F5) and set your breakpoints in the python as desired

View File

@ -64,8 +64,8 @@ folder.
### `fake` ### `fake`
Adds some fake data to the database. By default, ``fake`` creates one child and Adds some fake data to the database. By default, `fake` creates one child and
31 days of random data. Use the `--children` and `--days` flags to change the 31 days of random data. Use the `--children` and `--days` flags to change the
default values, e.g. `gulp fake --children 5 --days 7` to generate five fake default values, e.g. `gulp fake --children 5 --days 7` to generate five fake
children and seven days of data for each. children and seven days of data for each.
@ -104,7 +104,7 @@ non-overlapping arguments for this command.
### `reset` ### `reset`
Resets the database to a default state *with* one fake child and 31 days of Resets the database to a default state _with_ one fake child and 31 days of
fake data. fake data.
### `runserver` ### `runserver`

View File

@ -32,7 +32,7 @@ Add and commit the changes to the `requirements.txt` file.
If static file assets (files in a `static_src` directory) are updated the production If static file assets (files in a `static_src` directory) are updated the production
static files (in the [`static` directory](https://github.com/babybuddy/babybuddy/tree/master/static)) static files (in the [`static` directory](https://github.com/babybuddy/babybuddy/tree/master/static))
must also be updated *and committed*. This is done because it prevents the need for Node must also be updated _and committed_. This is done because it prevents the need for Node
and related tooling in deployment environments. See [`gulp updatestatic`](gulp-command-reference.md#updatestatic) and related tooling in deployment environments. See [`gulp updatestatic`](gulp-command-reference.md#updatestatic)
for more information on how to update the static files. for more information on how to update the static files.

View File

@ -12,36 +12,36 @@ to the project.
Baby Buddy has support for translation/localization. A manual translation Baby Buddy has support for translation/localization. A manual translation
process will look something like this: process will look something like this:
1. Set up a development environment (see [Development environment](development-environment.md)). 1. Set up a development environment (see [Development environment](development-environment.md)).
1. Run `gulp makemessages -l xx` where `xx` is a specific locale code in the 1. Run `gulp makemessages -l xx` where `xx` is a specific locale code in the
[ISO 639-1 format](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g., [ISO 639-1 format](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g.,
"il" for Italian or "es" for Spanish). This creates a new translation file at "il" for Italian or "es" for Spanish). This creates a new translation file at
`locale/xx/LC_MESSAGES/django.po`, or updates one if it exists. `locale/xx/LC_MESSAGES/django.po`, or updates one if it exists.
1. Open the created/updated `django.po` file and update the header template 1. Open the created/updated `django.po` file and update the header template
with license and contact info. with license and contact info.
1. Start translating! Each translatable string will have a `msgid` value with 1. Start translating! Each translatable string will have a `msgid` value with
the string in English and a corresponding (empty) `msgstr` value where a the string in English and a corresponding (empty) `msgstr` value where a
translated string can be filled in. translated string can be filled in.
1. Once all strings have been translated, run `gulp compilemessages -l xx` to 1. Once all strings have been translated, run `gulp compilemessages -l xx` to
compile an optimized translation file (`locale/xx/LC_MESSAGES/django.mo`). compile an optimized translation file (`locale/xx/LC_MESSAGES/django.mo`).
1. To expose the new translation as a user setting, add the locale code to the 1. To expose the new translation as a user setting, add the locale code to the
`LANGUAGES` array in the base settings file (`babybuddy/settings/base.py`). `LANGUAGES` array in the base settings file (`babybuddy/settings/base.py`).
1. Check if Plotly offers a translation (in `node_modules/plotly.js/dist/`) for 1. Check if Plotly offers a translation (in `node_modules/plotly.js/dist/`) for
the language. If it does: the language. If it does:
1. Add the Plotly translation file path to [`gulpfile.config.js`](https://github.com/babybuddy/babybuddy/tree/master/gulpfile.config.js) 1. Add the Plotly translation file path to [`gulpfile.config.js`](https://github.com/babybuddy/babybuddy/tree/master/gulpfile.config.js)
in `scriptsConfig.graph`. in `scriptsConfig.graph`.
2. Build, collect, and commit the `/static` folder (see [`gulp updatestatic`](gulp-command-reference.md#updatestatic)). 2. Build, collect, and commit the `/static` folder (see [`gulp updatestatic`](gulp-command-reference.md#updatestatic)).
1. Run the development server, log in, and update the user language to test the 1. Run the development server, log in, and update the user language to test the
newly translated strings. newly translated strings.
Once the translation is complete, commit the new files and changes to a fork Once the translation is complete, commit the new files and changes to a fork
and [create a pull request](pull-requests.md) for review. and [create a pull request](pull-requests.md) for review.

View File

@ -16,7 +16,7 @@ Baby Buddy as an Excel file:
1. Click "Diaper Changes" in the list of data types. 1. Click "Diaper Changes" in the list of data types.
1. Click the "Export" button above the filters list on the right side of the 1. Click the "Export" button above the filters list on the right side of the
screen. screen.
1. Select the "xlxs" format and click "Submit" 1. Select the "xlxs" format and click "Submit"
@ -34,7 +34,7 @@ import screen for a particular type will list the fields generally expected to
be present for an import. Multiple file types -- including csv, xlsx, etc. -- be present for an import. Multiple file types -- including csv, xlsx, etc. --
are supported for the import. are supported for the import.
The import pages do not provide *detailed* information about the required data The import pages do not provide _detailed_ information about the required data
and formats. All rows will be checked for errors on import and any issues will and formats. All rows will be checked for errors on import and any issues will
be reported on screen and will need to be resolved before the import can be be reported on screen and will need to be resolved before the import can be
performed. performed.

View File

@ -1,7 +1,7 @@
# Home # Home
A buddy for babies! Helps caregivers track sleep, feedings, diaper changes, A buddy for babies! Helps caregivers track sleep, feedings, diaper changes,
tummy time and more to learn about and predict baby's needs without (*as much*) tummy time and more to learn about and predict baby's needs without (_as much_)
guess work. guess work.
## Demo ## Demo

View File

@ -124,72 +124,72 @@ requirements are Python, a web server, an application server, and a database.
### Example deployment ### Example deployment
*This example assumes a 1 GB VPS instance with Ubuntu 20.04.* It uses Python 3.10, _This example assumes a 1 GB VPS instance with Ubuntu 20.04._ It uses Python 3.10,
nginx, uwsgi and sqlite. It should be sufficient for a few users (e.g., two parents nginx, uwsgi and sqlite. It should be sufficient for a few users (e.g., two parents
and any number of children). and any number of children).
1. Install system packages 1. Install system packages
```shell ```shell
sudo apt-get install python3 python3-pip nginx uwsgi uwsgi-plugin-python3 git libopenjp2-7-dev libpq-dev sudo apt-get install python3 python3-pip nginx uwsgi uwsgi-plugin-python3 git libopenjp2-7-dev libpq-dev
``` ```
2. Default python3 to python for this session 2. Default python3 to python for this session
```shell ```shell
alias python=python3 alias python=python3
``` ```
3. Install pipenv 3. Install pipenv
```shell ```shell
sudo -H pip3 install pipenv sudo -H pip3 install pipenv
``` ```
4. Set up directories and files 4. Set up directories and files
```shell ```shell
sudo mkdir /var/www/babybuddy sudo mkdir /var/www/babybuddy
sudo chown $USER:$(id -gn $USER) /var/www/babybuddy sudo chown $USER:$(id -gn $USER) /var/www/babybuddy
mkdir -p /var/www/babybuddy/data/media mkdir -p /var/www/babybuddy/data/media
git clone https://github.com/babybuddy/babybuddy.git /var/www/babybuddy/public git clone https://github.com/babybuddy/babybuddy.git /var/www/babybuddy/public
``` ```
5. Move in to the application folder 5. Move in to the application folder
```shell ```shell
cd /var/www/babybuddy/public cd /var/www/babybuddy/public
``` ```
6. Initiate and enter a Python environment with Pipenv locally. 6. Initiate and enter a Python environment with Pipenv locally.
```shell ```shell
export PIPENV_VENV_IN_PROJECT=1 export PIPENV_VENV_IN_PROJECT=1
pipenv install --three pipenv install --three
pipenv shell pipenv shell
``` ```
7. Create a production settings file and set the ``SECRET_KEY`` and ``ALLOWED_HOSTS`` values 7. Create a production settings file and set the `SECRET_KEY` and `ALLOWED_HOSTS` values
```shell ```shell
cp babybuddy/settings/production.example.py babybuddy/settings/production.py cp babybuddy/settings/production.example.py babybuddy/settings/production.py
editor babybuddy/settings/production.py editor babybuddy/settings/production.py
``` ```
8. Initiate the application 8. Initiate the application
```shell ```shell
export DJANGO_SETTINGS_MODULE=babybuddy.settings.production export DJANGO_SETTINGS_MODULE=babybuddy.settings.production
python manage.py migrate python manage.py migrate
``` ```
9. Set appropriate permissions on the database and data folder 9. Set appropriate permissions on the database and data folder
```shell ```shell
sudo chown -R www-data:www-data /var/www/babybuddy/data sudo chown -R www-data:www-data /var/www/babybuddy/data
sudo chmod 640 /var/www/babybuddy/data/db.sqlite3 sudo chmod 640 /var/www/babybuddy/data/db.sqlite3
sudo chmod 750 /var/www/babybuddy/data sudo chmod 750 /var/www/babybuddy/data
``` ```
10. Create and configure the uwsgi app 10. Create and configure the uwsgi app
@ -260,13 +260,13 @@ and any number of children).
See [Subdirectory configuration](subdirectory.md) for additional configuration See [Subdirectory configuration](subdirectory.md) for additional configuration
required if Baby Buddy will be hosted in a subdirectory of another server. required if Baby Buddy will be hosted in a subdirectory of another server.
14. Symlink config and restart NGINX: 13. Symlink config and restart NGINX:
```shell ```shell
sudo ln -s /etc/nginx/sites-available/babybuddy /etc/nginx/sites-enabled/babybuddy sudo ln -s /etc/nginx/sites-available/babybuddy /etc/nginx/sites-enabled/babybuddy
sudo service nginx restart sudo service nginx restart
``` ```
15. That's it (hopefully)! 14. That's it (hopefully)!
See [HTTPS/SSL configuration](ssl.md) for information on how to secure Baby Buddy. See [HTTPS/SSL configuration](ssl.md) for information on how to secure Baby Buddy.

View File

@ -21,7 +21,7 @@ the origin must be in `CSRF_TRUSTED_ORIGINS` to pass.
For example if Baby Buddy is configured in a container with a private network and a host For example if Baby Buddy is configured in a container with a private network and a host
`babybuddy` that is exposed publicly by a proxy (e.g., nginx) at the address `babybuddy` that is exposed publicly by a proxy (e.g., nginx) at the address
`https://baby.example.com` then form submissions from browsers will have an `Origin` of `https://baby.example.com` then form submissions from browsers will have an `Origin` of
`https://baby.example.com` that *does not match* the host `babybudy`. This will cause a `https://baby.example.com` that _does not match_ the host `babybudy`. This will cause a
CSRF error and the request will be rejected with a `403 Forbidden` error. To support CSRF error and the request will be rejected with a `403 Forbidden` error. To support
this example configuration the environment variable `CSRF_TRUSTED_ORIGINS` should be set this example configuration the environment variable `CSRF_TRUSTED_ORIGINS` should be set
to the full public address (including the scheme): `https://baby.example.com` for CSRF to the full public address (including the scheme): `https://baby.example.com` for CSRF

View File

@ -20,10 +20,10 @@ Set this environment variable to the subdirectory of the Baby Buddy installation
When using uWSGI and NGINX (as in the [example deployment](deployment.md#example-deployment)) When using uWSGI and NGINX (as in the [example deployment](deployment.md#example-deployment))
the following configurations are required. the following configurations are required.
*Assume the subdirectory `babybuddy` for configuration change examples below but this _Assume the subdirectory `babybuddy` for configuration change examples below but this
can be anything includes multiple subdirectories (e.g., `/my/apps/babybuddy`). Other can be anything includes multiple subdirectories (e.g., `/my/apps/babybuddy`). Other
paths used in these examples also assume a configuration based on the paths used in these examples also assume a configuration based on the
[example deployment](deployment.md#example-deployment).* [example deployment](deployment.md#example-deployment)._
### uWSGI ### uWSGI
@ -31,7 +31,7 @@ In the app configuration replace the `module` declaration with a `mount` declara
add the `manage-script-name` declaration and [`SUB_PATH`](../configuration/application.md#sub_path) add the `manage-script-name` declaration and [`SUB_PATH`](../configuration/application.md#sub_path)
environment variable to the `[uwsgi]` configuration block. environment variable to the `[uwsgi]` configuration block.
``` diff ```diff
- module = %(project).wsgi:application - module = %(project).wsgi:application
+ mount = /babybuddy=%(project).wsgi:application + mount = /babybuddy=%(project).wsgi:application
+ manage-script-name = true + manage-script-name = true
@ -41,21 +41,21 @@ environment variable to the `[uwsgi]` configuration block.
### NGINX ### NGINX
Alter the NGINX `server` configuration to include the desired subdirectory path in the Alter the NGINX `server` configuration to include the desired subdirectory path in the
app (Baby Buddy root) and media `location` declarations *and* add a new declaration for app (Baby Buddy root) and media `location` declarations _and_ add a new declaration for
the static `location`. the static `location`.
``` diff ```diff
- location / { - location / {
+ location /babybuddy { + location /babybuddy {
``` ```
``` diff ```diff
+ location /babybuddy/static { + location /babybuddy/static {
+ alias /var/www/babybuddy/public/static; + alias /var/www/babybuddy/public/static;
+ } + }
``` ```
``` diff ```diff
- location /media { - location /media {
+ location /babybuddy/media { + location /babybuddy/media {
``` ```

View File

@ -6,32 +6,32 @@ markdown_extensions:
- pymdownx.snippets - pymdownx.snippets
- pymdownx.superfences - pymdownx.superfences
nav: nav:
- 'index.md' - "index.md"
- 'Setup': - "Setup":
- 'setup/deployment.md' - "setup/deployment.md"
- 'setup/ssl.md' - "setup/ssl.md"
- 'setup/subdirectory.md' - "setup/subdirectory.md"
- 'setup/proxy.md' - "setup/proxy.md"
- 'Configuration': - "Configuration":
- 'configuration/intro.md' - "configuration/intro.md"
- 'configuration/application.md' - "configuration/application.md"
- 'configuration/database.md' - "configuration/database.md"
- 'configuration/email.md' - "configuration/email.md"
- 'configuration/homeassistant.md' - "configuration/homeassistant.md"
- 'configuration/security.md' - "configuration/security.md"
- 'configuration/storage.md' - "configuration/storage.md"
- 'User Guide': - "User Guide":
- 'user-guide/getting-started.md' - "user-guide/getting-started.md"
- 'user-guide/managing-users.md' - "user-guide/managing-users.md"
- 'user-guide/adding-entries.md' - "user-guide/adding-entries.md"
- 'user-guide/using-timers.md' - "user-guide/using-timers.md"
- 'Contributing': - "Contributing":
- 'contributing/development-environment.md' - "contributing/development-environment.md"
- 'contributing/translation.md' - "contributing/translation.md"
- 'contributing/pull-requests.md' - "contributing/pull-requests.md"
- 'contributing/gulp-command-reference.md' - "contributing/gulp-command-reference.md"
- 'import-export.md' - "import-export.md"
- 'api.md' - "api.md"
theme: theme:
name: material name: material
favicon: assets/images/favicon.svg favicon: assets/images/favicon.svg

File diff suppressed because it is too large Load Diff