TWISTRANET : NOTES FOR DEVELOPPERS
==================================

Devel platform installation
----------------------------

Prerequis:: 

git, wget, python2.6-dev, PIL (with lib-jpeg, lib-png), gettext, virtualenv

.. note:: Under Linux all these packages can be installed using the system packages manager

.. note:: virtualenv also installs PIP

Create a virtual env for the application

    $ virtualenv twistranet-devel
    $ cd twistranet-devel

Always use the python binaries from this new virtualenv
(Each time you will want to work with your app you will need this command line)

    $ source bin/activate  

Under  windows, the command is :

    $ Scripts\activate.bat

Fork Twistranet from github (with your login or public adress git://github.com/numericube/twistranet.git)

    (twistranet-devel) $ git clone https://yourlogin@github.com/numericube/twistranet.git ./numericube-twistranet

Install Twistranet in place with all dependencies (django, debug_toolbar, piston, haystack, solr-thumbnail, tinymce ...)

    (twistranet-devel) $ pip install -e ./numericube-twistranet

.. note:: the './' is important here, it can be replaced by any "path to" expression
.. note:: the '-e' is also VERY important for devel, this option do not install the product, but just simlink the devel package

Create a project in devel mode
------------------------------

At prompt, enter this command line

    (twistranet-devel) $ twistranet_project -d cogip MyProject

This will create a new project called "MyProject" in devel mode.

.. note:: the '-d' or '--develmode' option don't copy static files so you can develop on it when running the project
.. note:: the 'cogip' option bootstrap a complete example for your Project

The server is started on port 8000.

Start the server in debug mode
------------------------------

Enter CTR-C to stop the server

Go to project root

    (twistranet-devel) $ cd MyProject

Set twistranet in debug mode

Under Linux

    (twistranet-devel) $ echo $TWISTRANET_DEBUG="DEBUG"

Under Windows

    (twistranet-devel) $ set TWISTRANET_DEBUG="DEBUG"

And restart the server

    (twistranet-devel) $ python manage.py runserver

Admininistration
----------------

You can change the twistranet admin password

    (twistranet-devel) $ python manage.py changepassword admin

To leave the virtualenv

    (twistranet-devel) $ deactivate

Under MS Windows, the command is

    (twistranet-devel) $ cd ..
    (twistranet-devel) $ Scripts\deactivate.bat

Internationalisation
--------------------

Find new internationalized strings in your code
and update your .po files
more information here : http://docs.djangoproject.com/en/dev/topics/i18n/localization/
At each twistranet application root containing a locale folder (do not forget txt extensions)

    (twistranet-devel) $ django-admin.py makemessages -a -e html,txt,py

Compile your .po (it's a mandatory after each change)

    (twistranet-devel) $ django-admin.py compilemessages

If you have started a project in devel mode (-d option of twistranet_project command),
you can compile all your .po files at once:
Go to your project root and enter :

    (twistranet-devel) $ python manage.py compilemessages


Running Tests
-------------
To run all twistranet tests, at your Project root, just enter

    (twistranet-devel) $ python manage.py test twistranet

To run a specific test in one twistranet application (eg test_azerty in twistranet/twistapp/tests/MyTestCase)

    (twistranet-devel) $ python manage.py test twistranet.twistapp.MyTestCase.test_azerty

.. note:: the MyTestCase class must be called in the tests/__init__.py
