Poliqarp2 GUI Readme
====================

Initial release of Poliqarp2 GUI.


Dependencies
------------

The WEB GUI client is a portable Django application. It does not require
compilation, but some setup steps are required before using it. Its dependencies
are (tested versions in parentheses):
* Python3 interpreter available (3.4)
* requests python library installed (2.8.1)
* Django WEB framework installed (1.8.3)
* django-ckeditor library (5.0.2)
* django-crispy-forms library (1.5.2)
* psycopg2 library (2.6.1)
* postgres database (9.4)


Installation
------------

### 1. Postgresql database

The installation of the postgres database goes beyond the scope of this
document. Consult the postgres homepage or your system distribution documentation
for manuals on postgres installation. Installation guide can be found at:
https://wiki.postgresql.org/wiki/Detailed_installation_guides

After database installation you should create new user and database.

### 2. Python packages

The python libraries needed can be easily installed using pip3 tool. Consult
the pip3 homepage or your system distribution documentation for details
on installation.

Assuming pip3 is available you can easily install required Python packages
using command:

> pip3 install Django requests django-ckeditor django-crispy-forms psycopg2

or 

> pip3 install -r /path/to/poliqarp/gui/requirements.txt

After that all packages will be installed.


GUI Configuration
-----------------

### 1. Django settings file

GUI has some Django-standard configuration settings which may be changed
in a poliqarp_gui/settings.py file. 

Most important part of settings file refer to database credentials. Before
starting using Poliqarp2 GUI you must enter proper values of database user, 
password and db name.

Example:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'poliqarp-database',
        'USER': 'poliqarp-user',
        'PASSWORD': 'poliqarp',
        'HOST': 'localhost',
        'PORT': '',
    }
}

### 2. First run

Poliqarp2 GUI configuration is finished at it's first run. Before you could
use GUI it is crucial to run commands in the given order:

> python manage.py makemigrations app

> python manage.py makemigrations auth

> python manage.py migrate

At that point GUI should create all tables required to work.

### 3. Creating superuser

To access GUI additional features ea. user accounts it's necessary to create
superuser account with command:

> python manage.py create superuser

You will be prompted for superuser username, email address and password.


Running GUI
-----------

### 1. Starting application

To start Poliqarp2 GUI type following command:

> python manage.py runserver

If application starts with no errors you can now start using GUI. In that case
go to http://localhost:8000 (default GUI address can be changed in settings.py).


### 2. Using GUI

To use GUI you need one of modern web browsers (preferably Firefox or Chrome).
In browser go to address: 

http://localhost:8000

Main page of Poliqarp2 GUI will be served. From there you can start searching.


### 3. GUI admin page

Additionally, GUI offers a simple Content Management System accessible from:

http://localhost:8000/admin

It allows to set up things related to user accounts, privileges and edit 
additional contents of WEB GUI/start page. Details on this features can 
be found in the GUI manual.
