Update the README

This commit is contained in:
Rodolphe Breard 2019-07-24 21:23:37 +02:00
parent e044d955d8
commit 8c601c23a2

View file

@ -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.