unleashtheginger / EMFWebsite

The Electromagnetic Field web site

Home Page:http://www.emfcamp.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is the www.emfcamp.org web site, built with Flask & Postgres by the EMF web team.

Deploy Status Coverage Status

Get Involved

If you want to get involved, the best way is to join us on IRC, on #emfcamp-web on irc.libera.chat.

Join with IRCCloud:

Getting Started

The only supported way to develop is to use Docker with Docker Compose (on Linux you'll need to install Docker Compose separately) version 1.24.0 or newer.

Lazydocker is highly recommended to monitor the containers.

To start all containers (and rebuild any which may have changed):

docker compose build --parallel
docker compose up

You should then be able to view your development server on http://localhost:2342.

To create some fake data in your DB, run:

./flask dev data

To stop all containers, use docker compose stop To delete all data and start over fresh you can use docker compose down.

Management commands can be listed and run using the ./flask command, which forwards them to the flask command line within the container.

Errors starting the dev server

e.g. Error: While importing 'dev_server', an ImportError was raised.

If you've just updated and you're seeing errors when starting the dev server, first make sure you try:

    docker compose up --build

Tests

Tests are run using the ./run_tests script.

Code Style

For Python, we currently use Black and flake8 to enforce code style. These checks are run by ./run_tests.

However, it's easy to forget these checks, so you can also run them as a git pre-commit hook using pre-commit. To set this up on the host where you'll be using git:

pip3 install pre-commit
pre-commit install

Adding accounts

Once you've created an account on the website, you can use ./flask make_admin to make your user an administrator. Or, you can create an account and simultaneously make it an admin by using ./flask make_admin -e email@domain.tld

E-mail sending is disabled in development (but is printed out on the console). You can also log in directly by setting BYPASS_LOGIN=True in config/development.cfg and then using a URL of the form e.g. /login/admin@test.invalid.

Database Migrations

  • ./flask db migrate -m 'Migration name' to generate migration scripts when models have been updated.
  • ./flask db upgrade to run any migration scripts you've generated (or populate a fresh DB).
  • ./flask db downgrade to undo the last migration.

For more migration commands, see the flask-migrate docs.

More Docs

For more, see:

About

The Electromagnetic Field web site

http://www.emfcamp.org

License:GNU Affero General Public License v3.0


Languages

Language:Python 60.7%Language:HTML 33.8%Language:JavaScript 2.9%Language:SCSS 2.0%Language:Shell 0.4%Language:Dockerfile 0.1%Language:Makefile 0.0%Language:Mako 0.0%Language:Standard ML 0.0%