... | @@ -2,53 +2,60 @@ Install in your environment of choice: |
... | @@ -2,53 +2,60 @@ Install in your environment of choice: |
|
Examples below are given for a standard virtualenv/pip on ubuntu.
|
|
Examples below are given for a standard virtualenv/pip on ubuntu.
|
|
|
|
|
|
* postgresql, setup a user and create a database (default name is escriptorium)
|
|
* postgresql, setup a user and create a database (default name is escriptorium)
|
|
> $ sudo apt install postgresql postgresql-contrib
|
|
$ sudo apt install postgresql postgresql-contrib
|
|
> $ sudo -i -u postgres # switch to postgres user
|
|
$ sudo -i -u postgres # switch to postgres user
|
|
> $ createuser --interactive
|
|
$ createuser --interactive
|
|
> Enter name of role to add: <myusername> # use your system user name
|
|
Enter name of role to add: <myusername> # use your system user name
|
|
> Shall the new role be a superuser? (y/n) y
|
|
Shall the new role be a superuser? (y/n) y
|
|
> $ exit # logout from postgres user
|
|
$ exit # logout from postgres user
|
|
> $ createdb escriptorium
|
|
$ createdb escriptorium
|
|
|
|
|
|
* redis
|
|
* redis
|
|
> $ sudo apt-get install redis-server
|
|
$ sudo apt-get install redis-server
|
|
|
|
|
|
* elasticsearch
|
|
<!--* elasticsearch
|
|
set max_map_count permanently
|
|
set max_map_count permanently
|
|
> $ sudo sysctl -w vm.max_map_count=262144
|
|
$ sudo sysctl -w vm.max_map_count=262144 -->
|
|
|
|
|
|
* third party tools
|
|
* third party tools
|
|
> $ sudo apt-get install pngcrush
|
|
$ sudo apt-get install pngcrush
|
|
|
|
|
|
* env
|
|
* env
|
|
> $ apt-get install build-essential python-dev python3-dev
|
|
$ apt-get install build-essential python-dev python3-dev
|
|
> $ virtualenv env -p python3.7 (any version >= 3.7 should work)
|
|
$ virtualenv env -p python3.7 (any version >= 3.7 should work)
|
|
> $ . env/bin/activate
|
|
$ . env/bin/activate
|
|
> $ pip install -r app/requirements.txt
|
|
$ pip install -r app/requirements.txt
|
|
|
|
|
|
* The default settings needs to be override for devs
|
|
* The default settings needs to be override for devs
|
|
> $ cp app/escriptorium/local_settings.py{.example,}
|
|
$ cp app/escriptorium/local_settings.py{.example,}
|
|
> $ edit app/escriptorium/local_settings.py
|
|
$ edit app/escriptorium/local_settings.py
|
|
|
|
|
|
change for example the database role if need be, and then
|
|
change for example the database role if need be.
|
|
|
|
|
|
It is then recomanded to set $DJANGO_SETTINGS_MODULE
|
|
It is then recommended to set $DJANGO_SETTINGS_MODULE
|
|
|
|
|
|
> $ export $DJANGO_SETTINGS_MODULE escriptorium.local_settings
|
|
$ export $DJANGO_SETTINGS_MODULE escriptorium.local_settings
|
|
|
|
|
|
And use something like (direnv)[https://direnv.net/] to automate it.
|
|
|
|
|
|
|
|
|
|
And use something like (direnv)[https://direnv.net/] or use a custom shell script that sets it to automate it.
|
|
|
|
```shell
|
|
|
|
#!/bin/bash
|
|
|
|
export DJANGO_SETTINGS_MODULE=escriptorium.local_settings
|
|
|
|
python manage.py $@
|
|
|
|
```
|
|
|
|
Then everytime you would be using `python manage.py [args]`, you can use `./manage.sh [args]` instead.
|
|
|
|
|
|
Another option is to point the --settings option of the commands to the module.
|
|
Another option is to point the --settings option of the commands to the module.
|
|
|
|
|
|
|
|
|
|
* To run a basic celery worker listening on everything
|
|
* To run a basic celery worker listening on everything
|
|
> $ celery -A escriptorium worker -l INFO
|
|
$ celery -A escriptorium worker -l INFO
|
|
To disable celery you can set `CELERY_TASK_ALWAYS_EAGER = True`
|
|
To disable celery completely, and process everything synchronously, you can set `CELERY_TASK_ALWAYS_EAGER = True`
|
|
|
|
|
|
* Create the sql tables
|
|
* Create the sql tables
|
|
> $ cd app && python manage.py migrate (--settings=escriptorium.local_settings)
|
|
$ cd app/
|
|
|
|
$ python manage.py migrate (--settings=escriptorium.local_settings)
|
|
|
|
|
|
* Run the server
|
|
* Run the server
|
|
> $ cd app && python manage.py runserver (--settings=escriptorium.local_settings)
|
|
$ python manage.py runserver (--settings=escriptorium.local_settings)
|
|
|
|
|
|
The website should be accessible at http://localhost:8000/ |
|
The website should be accessible at http://localhost:8000/ |