Server Development
Important packages to know about
These, along with necessary version numbers are documented in
-
flask - a web framework
-
itsdangerous - a library for encoding data for transport
-
schematics - A JSON encoding, decoding, and validation library
-
babel - i18n library
-
transifex - not entirely a package, but worth knowing about here-- this is
-
sqlalchemy - a database ORM for managing database models, querying, etc.
-
pymongo - a database library for mongodb
-
lxml - an XML parsing library
- gunicorn - a wsgi fcgi server library
There are of course, other important libraries, but those listed above are the
Of secondary interest are the Flask modules:
-
flask marrow mailer -
- flask babel - an interface to babel from flask
Preparing the Development Environment
Checking out biggies
Initializing media server
Create a virtualenv, run it and initialize from requirements.txt
Create a secret key
python -c "import os ; print os.urandom(24)" > secret_key`
Initialize and install the database.
python manage.py init_db python manage.py install_media -f ../data/sma_media.xml python manage.py append_lexical_data -f ../data/n_smanob_test.xml
The latter only installs/updates definitions for existing words from the
python manage.py install_lexicon -f ../data/n_smanob.xml
Prepare JSON files
python manage.py prepare_json
Internationalisation
Extracting is a little tricky. Mind the dot at the end, as we need the
pybabel extract -F babel.cfg -o translations/messages.pot ../sma-client/ .
initialising translations
pybabel init -i translations/messages.pot -d translations -l sma pybabel init -i translations/messages.pot -d translations -l no pybabel init -i translations/messages.pot -d translations -l sv etc
updating
pybabel extract -F babel.cfg -o translations/messages.pot ../sma-client/ . pybabel update -i translations/messages.pot -d translations
compiling
pybabel compile -d translations
Updating from transifex
In order to use the transifex client, you need two things:
- the gïelese virtual environment enabled
- a user-specific configuration file for transifex in your own home
Transifex Documentation: http: //support.transifex.com/customer/portal/articles/1000855-configuring-the-client
user-specific file:~/.transifexrc
The short of it is to copy all this, and replace the password. If more
[https://www.transifex.com] hostname = https://www.transifex.com password = yourpasswordgoeshere! token = username = aajegebot
Basic operations
Once the virtualenv is enabled properly, this should mean that the
tx pull
A specific language can be specified also:
tx pull -l sma tx pull --language sma
After updating translation strings in messages.pot, send them to the
tx push --source
If you have made modifications locally to any of the translation files,
Further documentation on the command line tool's various options is here:
http: //support.transifex.com/customer/portal/articles/960804-overview
Additional docs:
* http://support.transifex.com/customer/portal/topics/440187-transifex-client/articles * `tx --help`
Management scripts
This is somewhat of a TODO: . There are several managment scripts for various
1. manage.py - For executing Flask-Actions, as well as database installation
Data structure overview
- Concepts (media, or phonetic/orthographic content) - See documentation in