From 8c601c23a22e247a252721f19e852f3d0b941d39 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Wed, 24 Jul 2019 21:23:37 +0200 Subject: [PATCH] Update the README --- README.md | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index f188226..34c5f68 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,23 @@ * gettext +## Code formatting + +In order to have a single Python coding style, please use [black](https://github.com/psf/black). However, auto-generated files and parts of external projects should not be reformatted. + +``` +$ black $(find . -type f -name "*\.py" -not -path "*/migrations/*" -not -path "./static_extra/bulma/*" -print) +``` + + ## Quick-start (development) ``` -git clone https://git.khaganat.net/Tycho/khaganat-web.git khaganat-web -cd khaganat-web -vim .env -PIPENV_VENV_IN_PROJECT=1 pipenv --three update -pipenv run ./manage.py compilemessages +$ git clone https://git.khaganat.net/Tycho/khaganat-web.git khaganat-web +$ cd khaganat-web +$ vim .env +$ PIPENV_VENV_IN_PROJECT=1 pipenv --three update +$ pipenv run ./manage.py compilemessages ``` When editing the `.env` file, you should at least set `KHAGANAT_SECRET_KEY` to a random value, `KHAGANAT_DEBUG` to `"True"` and `KHAGANAT_HOSTNAMES` to `"localhost"`. @@ -23,21 +32,21 @@ When editing the `.env` file, you should at least set `KHAGANAT_SECRET_KEY` to a To run this web application, you need a database. The simplest way is to download the one from the test server (`scp cipra.khaganat.net:/var/www/khaganat-web/db.sqlite3 db.sqlite3`). If you really want to start from scratch, you have to run the following commands: ``` -pipenv run ./manage.py migrate -pipenv run ./manage.py createsuperuser +$ pipenv run ./manage.py migrate +$ pipenv run ./manage.py createsuperuser ``` In order to display the Khaganat theme, you have to install bulma and build it : ``` -pipenv run ./manage.py bulma install -pipenv run ./manage.py bulma build +$ pipenv run ./manage.py bulma install +$ pipenv run ./manage.py bulma build ``` Now that everything has been set-up, you may run Django's internal debug server. ``` -pipenv run ./manage.py runserver +$ pipenv run ./manage.py runserver ``` If you created the database from scratch, Django will show an error when visiting the home page. To fix it, you need to go to `/admin/` and create a page with the `default` flag on. @@ -82,11 +91,11 @@ You can set the following variables in the `.env` file: ## Quick update ``` -cd khaganat-web -git pull -pipenv --three update -pipenv run ./manage.py migrate -pipenv run ./manage.py compilemessages +$ cd khaganat-web +$ git pull +$ pipenv --three update +$ pipenv run ./manage.py migrate +$ pipenv run ./manage.py compilemessages ``` If you are not in a development environment (runserver), you also have to run `pipenv run ./manage.py collectstatic --clear --noinput` and may have to restart the WSGI server.