forked from tryolabs/libreQDA
-
Notifications
You must be signed in to change notification settings - Fork 7
Installation Instructions (in English)
Joe Blankenship edited this page May 21, 2017
·
2 revisions
For convenience it is recommended to use a virtualenv.
- Install Virtualenv: (
sudo apt-get install python-virtualenv
in Debian / Ubuntu). - Once installed, create a Virtualenv:
virtualenv libreqda
. As of now, LibreQDA use python 2.7. You may need to usevirtualenv --python=python2.7 libreqda
- Activate the Virtualenv:
cd libreqda
and thensource bin/activate
.
- To install git (if not installed):
sudo apt-get install git
- Then download the source code for LibreQDA:
git clone https://github.com/libreqda/libreQDA.git
.
Before you can start you need to install some dependencies.
- Install
build-essential
:sudo apt-get install build-essential
. - Install MySQL:
sudo apt-get install mysql-server libmysqlclient-dev libevent-dev libxml2-dev libxslt1-dev
. - The
requirements.txt
file contains a list of dependencies to install (make sure your virtualenv is activated). Install all of them automatically with thecd libreQDA
commandpip install -r requirements.txt
. - If you run into errors during the automatic install,
cat requirements.txt
andpip install
each python library without the version number.
- Create a database for LibreQDA. The database encoding must be UTF-8 to avoid problems uploading documents.
mysql -u root -p
to activate mysql as user 'root' and request user password `CREATE DATABASE libreqda CHARACTER SET utf8 COLLATE utf8_general_ci; - Copy the
local_settings.py.template
file next to the code tolocal_settings.py
(in libreQDA/libreqda). - Open the new file,
local_settings.py
and edit as needed (change 'USER' and 'PASSWORD' to the mysql username and password). - Create the database with django:
python manage.py syncdb
. During the process, you will be asked for a username and password, which will be the access data to your installation of libreQDA - Run with:
python manage.py runserver
- Backup your data! Data is deleted from the database when a
reset
is performed. It is possible to useDumpdata
andLoaddata
to easily export and import data. - To update LibreQDA you simply need to pull the repository with
git pull
and then update the database withpython manage.py reset libreqda
. - It is also necessary to update dependencies with:
pip install -r requirements.txt
.
Adding support for other types of files is relatively simple. There are two files to modify:
* Validators.py
: Contains code to allow or not to upload a particular file type.
* Text_extraction.py
: Contains the code to extract the text of each of the different allowed file types.
- Open the
validators.py
file. - In the
SUPPORTED_FILETYPES
tuple add astring
with the file type. For example, for Postscript files, add'.ps'
to the tuple. - Open the `tex_extraction.py file.
- Add a new function with the file extension as the name. For example, to process Postscript files, add a function called
ps
. - The new function will receive a single parameter, this being the path to the new uploaded file. The function should open the file and extract the text, to finally return an object of type
string
with the contents of file. This value will be saved in the database.
Currently to determine the file type, LibreQDA is based on the extension. File type identification should be done using python-magic
.