Deployment

Note: this version of Ninamori CMS is tested only with python 2.7

Clone repo and install requirements

Optional: create a virtual environment, (you may need to install virtualenv package)

It is easier to use pip, you can get pip in Debian and Ubuntu with sudo apt-get install python-pip
After that you should upgrade pip with pip calling sudo pip install --upgrade pip
In most distros you can get the required tools with sudo pip install virtualenv virtualenvwrapper, you may need to restart your shell
Good way to set up the virtual environment is mkvirtualenv ninamori
Use the workon ninamori command to activate the virtual environment and deactivate to return things to normal (or you can just exit)
The name of the virtual environment in brackets at the beginning of the command prompt means you are in it
It is useful to make your workon to change directory right to where your manage.py is located, add cd ~/ninamori in ~/.virtualenvs/ninamori/bin/postactivate file to do so

Optional: add autocompleteon for django commands

For bash you can download and install this script
The simpliest way is something like this:
wget -O ~/.django_bash_completion.sh https://raw.github.com/django/django/master/extras/django_bash_completion && echo 'source $HOME/.django_bash_completion.sh' >> ~/.bashrc

Optional: fork repository to your bitbucket account

Go to Ninamori CMS Bitbucket page↷ and click "Fork" menu item
Edit fork initial settings

You will need git, use sudo apt-get install git if you have Debian or Ubuntu and somehow do not have git yet

git clone https://bitbucket.org/mlug/ninamori.git ninamori
cd ninamori
pip install --requirement requirements.txt

Clone templates repo into templates subdir

git clone https://bitbucket.org/mlug/ninamori_templates-base.git templates

Download and unpack the static files

Optional: make your own static files instead

wget https://bitbucket.org/mlug/ninamori/downloads/static.tar.gz
tar -xzf static.tar.gz
rm static.tar.gz

You have to put your icon to <where-is-your-ninamori>/static/img/icon.png, or else you will have no icon and 404 error for every request

Copy settings template and edit the copy to set the settings for your site

cp ninamori/settings.py.template ninamori/settings.py
nano ninamori/settings.py

Install and configure services for choosen backends

Setup the database and static files

Optional: Compile locale messages if you want to use translations by ./manage.py compilemessages

./manage.py makemigrations
./manage.py migrate
./manage.py collectstatic

Prepare your webserver

Either configure uWSGI service or just run the command ./manage.py runserver <ip address>[:port]

Use runserver command only for testing and development, do not use it in production
Web server configuration is a serious business and is not covered in this briefing
Author recommends to set up Nginx and to proxy uWSGI trough it
It is a good idea to serve static and media directly by Nginx

Add management commands to crontab

You may use any scheduler you like
manage.py sendmessages will queue email messages for your subscribers
manage.py update_gravatars will check if there are gravatar updates and will download them if needed
manage.py sendcommentnotifications will queue email messages with comment notifications for watcing commentators
manage.py send_queued will send queued email messages
manage.py clear_sent_messages will clear successfully sent email messages
Here is author´s crontab example:

*/30 * * * *  /home/www/ninamori/manage.py sendmessages --silent
0  2 * * * *  /home/www/ninamori/manage.py update_gravatars --silent
*/30 * * * *  /home/www/ninamori/manage.py sendcommentnotifications --silent
*/30 * * * *  /home/www/ninamori/manage.py send_queued_messages --limit=100
*/30 * * * *  /home/www/ninamori/manage.py clear_sent_messages --offset=300
Should you have any problems with the deployment, feel free to file a ticket↷ or to contact Goury.

Upgrading

This part of the readme is not planned before future release.
Generally you should always do ./manage.py makemigrations and ./manage.py migrate and drop cache (depends on caching backend of our choice).
You may also require to update your static files and almost always you will need to update your templates and settings to new version.
Check upgrading.txt for extra special information.

Contact Goury if you need help.

Management commands

Generate qr-tokens

./manage.py generate_polls_tokens --token_count <how many> --redirect <redirect> --qr
./manage.py generate_mailer_tokens --token_count <how many> --list_uuid <uuid> --qr

Use --qr6 or --qr24 to make printer-ready lists of qr codes
6 codes per A4 page or 24 codes per A2 page should be readable by any phone camera
Add --email=<email> to send email message with urls and images

Update userprofiles in case of emergency

./manage.py updateprofiles
Should you ever experience uncomplete userprofile object, you can try fix it with this command

General usage

Follow "Help page" link in the control panel.
By the way, it is a good idea to run the ./manage.py createsuperuser command to be able to log to the control panel.
Staff members you create will also have an access to the entire help page.

Yandex Money integration

Register an account for money.yandex.ru service
Type in your Yandex Money wallet id and secret in the ninamori/settings.py file
Create a Yandex Balance issue in the control panel
Place link <protocol>://<your-domain>/api/yandex-inform?id= in the Yandex Money http feedback settings