2018-01-26 20:28:45 +00:00
# Khaganat's web site
## Requirements
2018-02-09 20:39:08 +00:00
* Python 3.6 or newer
2018-01-26 20:28:45 +00:00
* pipenv
* git
2018-01-27 20:32:21 +00:00
* gettext
2018-01-26 20:28:45 +00:00
## Quick deployment
```
git clone https://git.khaganat.net/Tycho/khaganat-web.git khaganat-web
cd khaganat-web
vim .env
2018-05-27 09:28:13 +00:00
pipenv --three --update
2018-01-26 20:28:45 +00:00
pipenv run ./manage.py migrate
pipenv run ./manage.py collectstatic
2018-01-27 20:32:21 +00:00
pipenv run ./manage.py compilemessages
2018-01-27 20:38:38 +00:00
pipenv run ./manage.py createsuperuser
2018-01-26 20:28:45 +00:00
```
2018-05-27 09:28:13 +00:00
Then configure your server as you like. One way to deploy is to use Nginx and uWSGI:
* [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 )
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/ ).
2018-01-26 20:28:45 +00:00
## Environment variables
You can set the following variables in the `.env` file:
2018-05-27 09:28:13 +00:00
* `KHAGANAT_SECRET_KEY` (required): Django's secret key, keep it secret (tip: generate one using `openssl rand -base64 42` ).
2018-01-26 20:28:45 +00:00
* `KHAGANAT_DEBUG` : Debug mode, default is false.
* `KHAGANAT_HOSTNAMES` : Allowed hostnames, coma separated.
* `KHAGANAT_LANGUAGE_CODE` : Language code, default is `fr` .
* `KHAGANAT_TIME_ZONE` : Time zone, default is `Europe/Paris` .
* `KHAGANAT_STATIC_URL` : URL for static files, default is `/static/` .
* `KHAGANAT_STATIC_ROOT` : Absolute path to the directory where static files should be collected.
2018-01-27 17:58:36 +00:00
* `KHAGANAT_LOGS_MIN_DAYS` : Numbers of days before logs are hidden, default is 7.
* `KHAGANAT_LOGS_MAX_DAYS` : Number of days before logs are published, default is 0.
2018-02-04 00:36:39 +00:00
* `KHAGANAT_LOGIN_REDIRECT_URL` : URL to redirect after user login. Will be reversed, default is `index` .
* `KHAGANAT_REGISTER_REQUIRE_VALIDATION` : require email validation upon registration, default is true.
* `KHAGANAT_EMAIL_HOST` : The host to use for sending email, default is `localhost` .
* `KHAGANAT_EMAIL_PORT` : Port to use for the SMTP server, default is `25` .
* `KHAGANAT_EMAIL_HOST_USER` : Username to use for the SMTP server, default is empty (no authentication).
* `KHAGANAT_EMAIL_HOST_PASSWORD` : Password to use for the SMTP server, default is empty.
* `KHAGANAT_EMAIL_USE_TLS` : Whether to use a TLS connection to the SMTP server, default is `False` .
* `KHAGANAT_EMAIL_SUBJECT_PREFIX` : Subject-line prefix for email, default is empty.
* `KHAGANAT_DEFAULT_FROM_EMAIL` : Default email address to use, default is `no-reply@localhost` .
2018-02-04 16:12:22 +00:00
* `KHAGANAT_FORCE_HTTPS` : If True, enable the use of `KHAGANAT_HTTPS_HEADER_NAME` and `KHAGANAT_HTTPS_HEADER_VALUE` to set the `SECURE_PROXY_SSL_HEADER` configuration option. Default is `False` .
* `KHAGANAT_HTTPS_HEADER_NAME` : Header name for `SECURE_PROXY_SSL_HEADER` , default is `HTTP_X_FORWARDED_PROTO` .
* `KHAGANAT_HTTPS_HEADER_VALUE` : Header value for `SECURE_PROXY_SSL_HEADER` , default is `https` .