Update the README

This commit is contained in:
Rodolphe Breard 2018-11-07 16:58:11 +01:00
parent a13bba420f
commit 81caa19562

View file

@ -8,26 +8,30 @@
* gettext
## Quick deployment
## 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 migrate
pipenv run ./manage.py collectstatic --clear --noinput
pipenv run ./manage.py compilemessages
```
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
```
Then configure your server as you like. One way to deploy is to use Nginx and uWSGI:
Now that the database has been set up one way or another, you may run Django's internal debug server.
* [How to use Django with uWSGI](https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/uwsgi/)
* [Setting up Django and your web server with uWSGI and nginx](https://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html)
```
pipenv run ./manage.py runserver
```
You can get the virtualenv's path using `pipenv --venv`.
Do not forget to check the [deployment checklist](https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/).
If you created the database from scratch, Django will show an error when visiting the home page. To fix it, you need to got to `/admin/` and create a page with the `default` flag on.
## Environment variables
@ -68,15 +72,19 @@ cd khaganat-web
git pull
pipenv --three update
pipenv run ./manage.py migrate
pipenv run ./manage.py collectstatic --clear --noinput
pipenv run ./manage.py compilemessages
```
Then restart the WSGI server.
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.
## Nginx + uWSGI on ArchLinux
Before deploying, you may read the following guides:
* [How to use Django with uWSGI](https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/uwsgi/)
* [Setting up Django and your web server with uWSGI and nginx](https://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html)
Install `nginx-mainline`, `uwsgi` and `uwsgi-plugin-python`.
```
@ -162,3 +170,5 @@ Finish the installation:
# systemctl enable nginx.service
# systemctl start nginx.service
```
Do not forget to check the [deployment checklist](https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/).