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.
inputs:
python-version:
description: 'What Python version to use.'
description: "What Python version to use."
required: false
default: '3.x'
default: "3.x"
runs:
using: 'composite'
using: "composite"
steps:
- name: Install Pipenv
shell: bash
@ -15,8 +15,8 @@ runs:
id: setup-python
with:
python-version: ${{ inputs.python-version }}
cache: 'pipenv'
cache-dependency-path: 'requirements.txt'
cache: "pipenv"
cache-dependency-path: "requirements.txt"
- name: Install Python dependencies
shell: bash
run: pipenv install --dev

View File

@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.10', '3.11', '3.12' ]
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
@ -71,5 +71,5 @@ jobs:
- name: Push to dokku
uses: dokku/github-action@master
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 }}

View File

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

View File

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

View File

@ -2,7 +2,4 @@ vendor
**/static
*.html
*.css
*.md
*.yaml
*.yml
*.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)
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.
![Baby Buddy desktop view](screenshot.png)
@ -56,7 +56,7 @@ for information about how to create/update translations.
:uk: English (U.K.)
:us: English (U.S.) *(base)*
:us: English (U.S.) _(base)_
:finland: Finnish

View File

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

View File

@ -7,4 +7,4 @@ inputs:
nixpkgs:
follows: nixpkgs
mk-shell-bin:
url: github:rrbutani/nix-mk-shell-bin
url: github:rrbutani/nix-mk-shell-bin

View File

@ -67,17 +67,17 @@ curl -X GET 'https://[...]/api/changes/?limit=5&offset=10' -H 'Authorization: To
```json
{
"count": 20,
"next": "https://[...]/api/changes/?limit=5&offset=15",
"previous": "https://[...]/api/changes/?limit=5&offset=5",
"results": []
"count": 20,
"next": "https://[...]/api/changes/?limit=5&offset=15",
"previous": "https://[...]/api/changes/?limit=5&offset=5",
"results": []
}
```
Field-based filters for specific endpoints can be found the in the `filters`
field of the `OPTIONS` response for specific endpoints.
Single entries can also be retrieved by adding the ID (or in the case of a
Single entries can also be retrieved by adding the ID (or in the case of a
Child entry, the slug) of a particular entry:
```shell
@ -86,12 +86,12 @@ curl -X GET https://[...]/api/children/gregory-hill/ -H 'Authorization: Token [.
```json
{
"id":3,
"first_name":"Gregory",
"last_name":"Hill",
"birth_date":"2020-02-11",
"slug":"gregory-hill",
"picture":null
"id": 3,
"first_name": "Gregory",
"last_name": "Hill",
"birth_date": "2020-02-11",
"slug": "gregory-hill",
"picture": null
}
```
@ -101,12 +101,12 @@ curl -X GET https://[...]/api/sleep/1/ -H 'Authorization: Token [...]'
```json
{
"id":480,
"child":3,
"start":"2020-03-12T21:25:28.916016-07:00",
"end":"2020-03-13T01:34:28.916016-07:00",
"duration":"04:09:00",
"nap":false
"id": 480,
"child": 3,
"start": "2020-03-12T21:25:28.916016-07:00",
"end": "2020-03-13T01:34:28.916016-07:00",
"duration": "04:09:00",
"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.
- `previous`: URL for the previous set of results.
- `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
(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
*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
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`
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**
if the `timer` field is *not* set.
if the `timer` field is _not_ set.
#### Example `timer` field usage
@ -218,12 +218,12 @@ Note the timer `id` in the response:
```json
{
"id": 5,
"child": 1,
"name": null,
"start": "2022-05-28T19:59:40.013914Z",
"duration": null,
"user": 1
"id": 5,
"child": 1,
"name": null,
"start": "2022-05-28T19:59:40.013914Z",
"duration": null,
"user": 1
}
```
@ -240,13 +240,13 @@ Note that `child` and `start` match the timer values (and `end` is auto-populate
```json
{
"id": 162,
"child": 1,
"start": "2022-05-28T19:59:40.013914Z",
"end": "2022-05-28T20:01:13.549099Z",
"duration": "00:01:33.535185",
"milestone": "",
"tags": []
"id": 162,
"child": 1,
"start": "2022-05-28T19:59:40.013914Z",
"end": "2022-05-28T20:01:13.549099Z",
"duration": "00:01:33.535185",
"milestone": "",
"tags": []
}
```

View File

@ -2,16 +2,16 @@
## `DEBUG`
*Default:* `False`
_Default:_ `False`
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).
## `SUB_PATH`
*Default:* `None`
_Default:_ `None`
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
@ -22,7 +22,7 @@ details.
## `TIME_ZONE`
*Default:* `UTC`
_Default:_ `UTC`
The default time zone to use for the instance. This value can be overridden per use from
the user settings form.

View File

@ -2,7 +2,7 @@
## `DB_ENGINE`
*Default:* `django.db.backends.sqlite3`
_Default:_ `django.db.backends.sqlite3`
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`
*Default:* unset
_Default:_ unset
The name of the database host for the deployment.
## `DB_NAME`
*Default:* `BASE_DIR/data/db.sqlite3`
_Default:_ `BASE_DIR/data/db.sqlite3`
The name of the database table utilized for the deployment.
## `DB_PASSWORD`
*Default:* unset
_Default:_ unset
The password for the database user for the deployment. In the default example,
this is the root PostgreSQL password.
## `DB_PORT`
*Default:* unset
_Default:_ unset
The listening port for the database. The default port for PostgreSQL is 5432.
## `DB_USER`
*Default:* unset
_Default:_ unset
The database username utilized for the deployment.
## `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'}`.

View File

@ -2,51 +2,51 @@
## `EMAIL_HOST`
*Default:* `None`
_Default:_ `None`
The host to use for sending email. This must be set to enable SMTP email delivery.
## `EMAIL_HOST_PASSWORD`
*Default:* (empty)
_Default:_ (empty)
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.
## `EMAIL_HOST_USER`
*Default:* (empty)
_Default:_ (empty)
Username to use for the SMTP server defined in `EMAIL_HOST`.
## `EMAIL_PORT`
*Default:* 25
_Default:_ 25
Port to use for the SMTP server defined in `EMAIL_HOST`.
## `EMAIL_USE_TLS`
*Default:* `False`
_Default:_ `False`
Whether to use a TLS (secure) connection when talking to the SMTP server.
## `EMAIL_USE_SSL`
*Default:* `False`
_Default:_ `False`
Whether to use an implicit TLS (secure) connection when talking to the SMTP server.
## `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
PEM-formatted certificate chain file to use for the SSL connection.
## `EMAIL_SSL_CERTFILE`
*Default:* `None`
_Default:_ `None`
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`
*Default:* `False`
_Default:_ `False`
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).

View File

@ -3,4 +3,4 @@
Environment variables can be used to define a number of configuration settings.
Baby Buddy will check the application directory structure for an `.env` file or
take these variables from the system environment. **System environment variables
take precedence over the contents of an `.env` file.**
take precedence over the contents of an `.env` file.**

View File

@ -2,10 +2,10 @@
## `ALLOWED_HOSTS`
*Default:* `*` (any host)
_Default:_ `*` (any host)
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.
@ -21,16 +21,17 @@ Do not include schemes ("http" or "https") with this setting.
## `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).
**See also**
- [Django's documentation on the `CSRF_COOKIE_SECURE` setting](https://docs.djangoproject.com/en/5.0/ref/settings/#csrf-cookie-secure)
## `CSRF_TRUSTED_ORIGINS`
*Default:* `None`
_Default:_ `None`
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.
@ -49,12 +50,12 @@ Each entry must contain both the scheme (http, https) and fully-qualified domain
## `PROXY_HEADER`
*Default:* `HTTP_REMOTE_USER`
_Default:_ `HTTP_REMOTE_USER`
Sets the header to read the authenticated username from when
`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**
@ -62,16 +63,17 @@ Baby Buddy modifies headers in the HTTP request; HTTP headers in the request hav
HTTP_X_AUTH_USER
**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 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`
*Default:* `False`
_Default:_ `False`
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.
**See also**
@ -80,7 +82,7 @@ ensure the headers are not forwarded from sources other than your proxy.
## `SECRET_KEY`
*Default:* `None`
_Default:_ `None`
A random, unique string must be set as the "secret key" before Baby Buddy can
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`
*Default:* `None`
_Default:_ `None`
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
@ -104,9 +106,10 @@ came in via HTTPS).
## `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).
**See also**
- [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`
*Default:* `True`
_Default:_ `True`
Whether to allow uploads (e.g., of Child photos).
## `AWS_ACCESS_KEY_ID`
*Default:* `None`
_Default:_ `None`
Required to access your AWS S3 bucket, should be uniquely generated per bucket
for security.
@ -17,7 +17,7 @@ See also: [`AWS_STORAGE_BUCKET_NAME`](#aws_storage_bucket_name)
## `AWS_SECRET_ACCESS_KEY`
*Default:* `None`
_Default:_ `None`
Required to access your AWS S3 bucket, should be uniquely generated per bucket
for security.
@ -26,14 +26,14 @@ See also: [`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
its name. See django-storages' [Amazon S3 documentation](https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html).
## `AWS_S3_ENDPOINT_URL`
*Default:* `None`
_Default:_ `None`
Custom URL to use when connecting to S3, including scheme.
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
```shell
pipenv install --three --dev
```
```shell
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)
```shell
nvm install 18
```
```shell
nvm install 18
```
1. Activate Node 18.x
```shell
nvm use
```
```shell
nvm use
```
1. Install Gulp CLI
```shell
npm install -g gulp-cli
```
```shell
npm install -g gulp-cli
```
1. Install required Node packages
```shell
npm install
```
```shell
npm install
```
1. Set, at least, the `DJANGO_SETTINGS_MODULE` environment variable
```shell
export DJANGO_SETTINGS_MODULE=babybuddy.settings.development
```
```shell
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](../configuration/intro.md) for other
settings and methods for defining them.
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.
1. Migrate the database
```shell
gulp migrate
```
```shell
gulp migrate
```
1. Build assets and run the server
```shell
gulp
```
```shell
gulp
```
This command will also watch for file system changes to rebuild assets and
restart the server as needed.
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](http://127.0.0.1:8000) and log in with the default
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. git clone the repo
1. here you have two options
1. run `devenv shell` and then run `gulp`
1. _OR_ run `devenv up` which automatically runs gulp/nodejs/python as well
1. run `devenv shell` and then run `gulp`
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
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.
### Debugging in devenv + vscode
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
{
// 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
}
]
// 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
}
]
}
```
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

View File

@ -2,7 +2,7 @@
## Definitions
Baby Buddy's Gulp commands are defined in [`gulpfile.js`](https://github.com/babybuddy/babybuddy/tree/master/gulpfile.js).
Baby Buddy's Gulp commands are defined in [`gulpfile.js`](https://github.com/babybuddy/babybuddy/tree/master/gulpfile.js).
Baby Buddy's management commands are defined in [`babybuddy/management/commands`](https://github.com/babybuddy/babybuddy/tree/master/babybuddy/management/commands).
@ -64,8 +64,8 @@ folder.
### `fake`
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
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
default values, e.g. `gulp fake --children 5 --days 7` to generate five fake
children and seven days of data for each.
@ -87,7 +87,7 @@ Executes Python and SASS linting for all relevant source files.
Executes Django's `makemessages` management task. See [django-admin makemessages](https://docs.djangoproject.com/en/5.0/ref/django-admin/#makemessages)
for more details about other options and functionality of this command. When
working on a single translation, the `-l` flag is useful to make message for
working on a single translation, the `-l` flag is useful to make message for
only that language, e.g. `gulp makemessages -l fr` to make only a French
language translation file.
@ -104,7 +104,7 @@ non-overlapping arguments for this command.
### `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.
### `runserver`
@ -151,4 +151,4 @@ order:
- [`collectstatic`](#collectstatic)
Execute and commit changes made by this command whenever changing Baby Buddy's
frontend code (SASS, JS, etc.).
frontend code (SASS, JS, etc.).

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
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)
for more information on how to update the static files.
@ -50,6 +50,6 @@ requires some extra steps. See [Translation](translation.md) for details.
4. Updated static assets if necessary and commit the `/static` folder (see [`gulp updatestatic`](gulp-command-reference.md#updatestatic)).
5. Open a [new pull request](https://github.com/babybuddy/babybuddy/compare) against
the `master` branch.
Maintainers will review new pull requests will as soon as possible, and we will
do our best to provide feedback and support potential contributors.

View File

@ -2,7 +2,7 @@
## POEditor
Baby Buddy uses [POEditor](https://poeditor.com/) for translation contributions.
Baby Buddy uses [POEditor](https://poeditor.com/) for translation contributions.
Interested contributors can [join translation of Baby Buddy](https://poeditor.com/join/project/QwQqrpTIzn)
for access to a simple, web-based frontend for adding/editing translation files
to the project.
@ -12,39 +12,39 @@ to the project.
Baby Buddy has support for translation/localization. A manual translation
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
[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
`locale/xx/LC_MESSAGES/django.po`, or updates one if it exists.
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.,
"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.
1. Open the created/updated `django.po` file and update the header template
with license and contact info.
1. Open the created/updated `django.po` file and update the header template
with license and contact info.
1. Start translating! Each translatable string will have a `msgid` value with
the string in English and a corresponding (empty) `msgstr` value where a
translated string can be filled in.
1. Start translating! Each translatable string will have a `msgid` value with
the string in English and a corresponding (empty) `msgstr` value where a
translated string can be filled in.
1. Once all strings have been translated, run `gulp compilemessages -l xx` to
compile an optimized translation file (`locale/xx/LC_MESSAGES/django.mo`).
1. Once all strings have been translated, run `gulp compilemessages -l xx` to
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
`LANGUAGES` array in the base settings file (`babybuddy/settings/base.py`).
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`).
1. Check if Plotly offers a translation (in `node_modules/plotly.js/dist/`) for
the language. If it does:
1. Check if Plotly offers a translation (in `node_modules/plotly.js/dist/`) for
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)
in `scriptsConfig.graph`.
1. Add the Plotly translation file path to [`gulpfile.config.js`](https://github.com/babybuddy/babybuddy/tree/master/gulpfile.config.js)
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
newly translated strings.
1. Run the development server, log in, and update the user language to test the
newly translated strings.
Once the translation is complete, commit the new files and changes to a fork
and [create a pull request](pull-requests.md) for review.
For more information on the Django translation process, see Django's
For more information on the Django translation process, see Django's
documentation section: [Translation](https://docs.djangoproject.com/en/5.0/topics/i18n/translation/).

View File

@ -16,7 +16,7 @@ Baby Buddy as an Excel file:
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
screen.
screen.
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. --
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
be reported on screen and will need to be resolved before the import can be
performed.

View File

@ -1,7 +1,7 @@
# Home
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*)
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_)
guess work.
## Demo

View File

@ -124,72 +124,72 @@ requirements are Python, a web server, an application server, and a database.
### 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
and any number of children).
1. Install system packages
```shell
sudo apt-get install python3 python3-pip nginx uwsgi uwsgi-plugin-python3 git libopenjp2-7-dev libpq-dev
```
```shell
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
```shell
alias python=python3
```
```shell
alias python=python3
```
3. Install pipenv
```shell
sudo -H pip3 install pipenv
```
```shell
sudo -H pip3 install pipenv
```
4. Set up directories and files
```shell
sudo mkdir /var/www/babybuddy
sudo chown $USER:$(id -gn $USER) /var/www/babybuddy
mkdir -p /var/www/babybuddy/data/media
git clone https://github.com/babybuddy/babybuddy.git /var/www/babybuddy/public
```
```shell
sudo mkdir /var/www/babybuddy
sudo chown $USER:$(id -gn $USER) /var/www/babybuddy
mkdir -p /var/www/babybuddy/data/media
git clone https://github.com/babybuddy/babybuddy.git /var/www/babybuddy/public
```
5. Move in to the application folder
```shell
cd /var/www/babybuddy/public
```
```shell
cd /var/www/babybuddy/public
```
6. Initiate and enter a Python environment with Pipenv locally.
```shell
export PIPENV_VENV_IN_PROJECT=1
pipenv install --three
pipenv shell
```
```shell
export PIPENV_VENV_IN_PROJECT=1
pipenv install --three
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
cp babybuddy/settings/production.example.py babybuddy/settings/production.py
editor babybuddy/settings/production.py
```
```shell
cp babybuddy/settings/production.example.py babybuddy/settings/production.py
editor babybuddy/settings/production.py
```
8. Initiate the application
```shell
export DJANGO_SETTINGS_MODULE=babybuddy.settings.production
python manage.py migrate
```
```shell
export DJANGO_SETTINGS_MODULE=babybuddy.settings.production
python manage.py migrate
```
9. Set appropriate permissions on the database and data folder
```shell
sudo chown -R www-data:www-data /var/www/babybuddy/data
sudo chmod 640 /var/www/babybuddy/data/db.sqlite3
sudo chmod 750 /var/www/babybuddy/data
```
```shell
sudo chown -R www-data:www-data /var/www/babybuddy/data
sudo chmod 640 /var/www/babybuddy/data/db.sqlite3
sudo chmod 750 /var/www/babybuddy/data
```
10. Create and configure the uwsgi app
@ -260,13 +260,13 @@ and any number of children).
See [Subdirectory configuration](subdirectory.md) for additional configuration
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
sudo ln -s /etc/nginx/sites-available/babybuddy /etc/nginx/sites-enabled/babybuddy
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.

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
`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` 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
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

View File

@ -82,7 +82,7 @@ SSL certificates. Other methods can be used to obtain and install a certificate
desired.
[Certbot](https://certbot.eff.org/instructions) is used to obtain free SSL certificates
from Let's Encrypt.
from Let's Encrypt.
```shell
snap install core && snap refresh core

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))
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
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
@ -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)
environment variable to the `[uwsgi]` configuration block.
``` diff
```diff
- module = %(project).wsgi:application
+ mount = /babybuddy=%(project).wsgi:application
+ manage-script-name = true
@ -41,21 +41,21 @@ environment variable to the `[uwsgi]` configuration block.
### NGINX
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`.
``` diff
```diff
- location / {
+ location /babybuddy {
```
``` diff
```diff
+ location /babybuddy/static {
+ alias /var/www/babybuddy/public/static;
+ }
```
``` diff
```diff
- location /media {
+ location /babybuddy/media {
```
```

View File

@ -17,7 +17,7 @@ an overview of all elements related to your child, including:
- Last feeding is the time from the start of the last feed and how/where the milk came from (a bottle, or breast).
- Last diaper change is the time the last diaper change was logged and includes the type of diaper.
- Last sleep is the start of the last nap/sleep, and includes the nap duration below.
- Last feeding method is a quick view of how the baby was last fed. This is particularly useful for nursing mothers to remember which breast they started with on the previous feed.
- Last feeding method is a quick view of how the baby was last fed. This is particularly useful for nursing mothers to remember which breast they started with on the previous feed.
- Today's Feeding is a snapshot of the total numbers of daily feeds.
- Timers let you know if you have a timer running.
- Statistics is a snapshot of various statistics these can be scrolled through or select Statistics from the menu bar to see more.

View File

@ -6,32 +6,32 @@ markdown_extensions:
- pymdownx.snippets
- pymdownx.superfences
nav:
- 'index.md'
- 'Setup':
- 'setup/deployment.md'
- 'setup/ssl.md'
- 'setup/subdirectory.md'
- 'setup/proxy.md'
- 'Configuration':
- 'configuration/intro.md'
- 'configuration/application.md'
- 'configuration/database.md'
- 'configuration/email.md'
- 'configuration/homeassistant.md'
- 'configuration/security.md'
- 'configuration/storage.md'
- 'User Guide':
- 'user-guide/getting-started.md'
- 'user-guide/managing-users.md'
- 'user-guide/adding-entries.md'
- 'user-guide/using-timers.md'
- 'Contributing':
- 'contributing/development-environment.md'
- 'contributing/translation.md'
- 'contributing/pull-requests.md'
- 'contributing/gulp-command-reference.md'
- 'import-export.md'
- 'api.md'
- "index.md"
- "Setup":
- "setup/deployment.md"
- "setup/ssl.md"
- "setup/subdirectory.md"
- "setup/proxy.md"
- "Configuration":
- "configuration/intro.md"
- "configuration/application.md"
- "configuration/database.md"
- "configuration/email.md"
- "configuration/homeassistant.md"
- "configuration/security.md"
- "configuration/storage.md"
- "User Guide":
- "user-guide/getting-started.md"
- "user-guide/managing-users.md"
- "user-guide/adding-entries.md"
- "user-guide/using-timers.md"
- "Contributing":
- "contributing/development-environment.md"
- "contributing/translation.md"
- "contributing/pull-requests.md"
- "contributing/gulp-command-reference.md"
- "import-export.md"
- "api.md"
theme:
name: material
favicon: assets/images/favicon.svg
@ -47,4 +47,4 @@ theme:
repo_name: babybuddy/babybuddy
repo_url: https://github.com/babybuddy/babybuddy
site_name: Baby Buddy Documentation
site_url: https://docs.baby-buddy.net
site_url: https://docs.baby-buddy.net

File diff suppressed because it is too large Load Diff