2023-05-03 19:19:38 -07:00
👕 Linter
2023-04-19 11:32:26 -07:00
2023-05-03 14:11:17 -07:00
2023-04-29 16:41:27 -05:00
2023-05-01 16:15:33 -04:00
2023-05-02 22:31:43 -03:00
2021-10-09 09:53:46 +01:00
🎨 footer
2023-05-01 18:54:47 -04:00
2023-04-14 13:36:28 -07:00
2023-04-28 16:11:47 -07:00
2023-04-29 16:41:27 -05:00
2023-02-15 14:44:20 -08:00
2022-07-17 11:38:06 -05:00
2023-04-04 09:23:04 -07:00
2021-10-09 09:53:46 +01:00
2023-02-10 12:51:49 -06:00
2021-12-20 13:36:06 -06:00
2021-10-09 09:53:46 +01:00
2023-04-28 09:21:48 -04:00
2022-11-17 08:51:57 -05:00
2023-04-28 09:25:47 -04:00
2023-04-29 16:41:27 -05:00
2023-05-03 19:19:38 -07:00
2023-04-26 11:19:39 -04:00
2023-04-28 09:21:48 -04:00

Boost.org Website

Overview

A Django based website that will power https://boost.org


Local Development Setup

This project will use Python 3.11, Docker, and Docker Compose.

NOTE: All of these various docker compose commands, along with other helpful developer utility commands, are codified in our justfile and can be ran with less typing.

You will need to install just, by following the documentation

Environment Variables: Copy file env.template to .env and adjust values to match your local environment. See Environment Variables for more information.

$ cp env.template .env

NOTE: Double check that the exposed port assigned to the PostgreSQL container does not clash with a database or other server you have running locally.

Then run:

# start our services (and build them if necessary)
$ docker compose up

# to create a superuser
$ docker compose run --rm web python manage.py createsuperuser

# to create database migrations
$ docker compose run --rm web python manage.py makemigrations

# to run database migrations
$ docker compose run --rm web python manage.py migrate

This will create the Docker image, install dependencies, start the services defined in docker-compose.yml, and start the webserver.

Cleaning up

To shut down our database and any long running services, we shut everyone down using:

$ docker compose down

Running the tests

To run the tests, execute:

$ docker compose run --rm web pytest

or run:

$ just test

Yarn and Tailwind

To install dependencies, execute:

$ yarn

For development purposes, in a secondary shell run the following yarn script configured in package.json which will build styles.css with the watcher.

$ yarn dev

For production, execute:

$ yarn build

Generating Local Data

Sample (Fake) Data

To remove all existing data (except for superusers) from your local project's database (which is in its own Docker volume) and generate fresh sample data that will not sync with GitHub, run:

./manage.py create_sample_data --all

For more information on the many, many options available for this command, see create_sample_data in Management Commands.

Live GitHub Libraries

To add real Boost libraries and sync all the data from GitHub, run:

./manage.py update_libraries

This command can take a long time to run (about a half hour). For more information, see update_libraries in Management Commands.


Deploying

TDB

Production Environment Considerations

TDB


Pre-commit Hooks

We use pre-commit hooks to check code for style, syntax, and other issues. They help to maintain consistent code quality and style across the project, and prevent issues from being introduced into the codebase.

Pre-commit is configured for the following:

  • Black: Formats Python code using the black code formatter.
  • Ruff: Wrapper around flake8 and isort, among other linters
  • Djhtml: for cleaning up django templates
  • Rustywind for sorting tailwind classes

Add the hooks by running:

pre-commit install

Now, the pre-commit hooks will automatically run before each commit. If any hook fails, the commit will be aborted, and you'll need to fix the issues and try committing again.

Running pre-commit hooks locally

Ensure you have Python and pip installed.

Install pre-commit: run:

pip install pre-commit

Install the hooks: navigate to the root directory and run:

pre-commit install

To **run individual hooks, run:

pre-commit run {hook}

Example:

pre-commit run black

or

pre-commit run djhtml

To preview what the pre-commit hooks would catch in the changes you are about to commit, run:

pre-commit run

To preview what the pre-commit hooks would catch across the whole project, run:

pre-commit run --all-files

To skip running the pre-commit hooks for some reason, run:

git commit -m "Your commit message" --no-verify

This will allow you to commit without running the hooks first. When you push your branch, you will still need to resolve issues that CI catches.

Note: Added this when a couple of us installed pre-commit and got the Big Angry List, so I wanted to save is a Google.

Description
Mirrored via gitea-mirror
Readme 31 MiB
Languages
HTML 66%
Python 27.4%
CSS 4.7%
Shell 0.9%
PowerShell 0.3%
Other 0.5%