wiki:GetInvolved/Trac/Development
Last modified 3 years ago Last modified on 01/19/2014 01:08:50 AM

How to start develop on Trac

To develop a macro or something else on Trac on Ubuntu you will need to install and setup virtualenv

sudo apt-get install python-virtualenv
virtualenv --no-site-packages ~/.virtualenv/trac
source ~/.virtualenv/trac/bin/activate

Then you install "the" 'Trac'

pip install trac

Create folder that will contain files and folders of Trac' project:

mkdir ~/TRACenv
trac-admin ~/TRACenv initenv

This will ask you for project name, it offer answare in [My Project], and for database. Now you have # ~/TRACenv/conf/trac.ini file that contains all configuration. We need to edit this and add above lines to use TOC macro:

[components]
trac.ticket.report.ReportModule = disabled
webadmin.* = enabled

Authentication

If we have installed

sudo apt-get install apache2-utils

we can use htpasswd to add new user adminwe add with

sudo htpasswd /path/to/.htpasswd admin

or use

touch /path/to/.htpasswd

and webpage http://aspirine.org/htpasswd_en.html to generate .htpasswd file and insert this to our

vim /path/to/.htpasswd

Now we tell Trac to use our user from .htpasswd to be Trac admin by running this line

trac-admin ~/TRACenv permission add admin TRAC_ADMIN

Trac should be runnable now. [ Run it]

TOC macro

To use TOC macro we need to edit ~/TRACenv/conf/trac.ini file and add above lines under [components] segment:

[components]
tractoc.* = enabled
trac.ticket.report.ReportModule = disabled
webadmin.* = enabled

create working folder for TOC macro, download last version, make runnable script and install macro

mkdir ~/TOCmacro
cd ~/TOCmacro/
svn co http://trac-hacks.org/svn/tocmacro/0.11/
cd 0.11/
chmod +x setup.py
./setup.py develop

Runing Trac

Here you should open new terminal tab, activate virtualenv

source ~/.virtualenv/trac/bin/activate

and run trac

tracd -p 8000 --basic-auth="TRACenv,/path/to/.htpasswd,My project" ~/TRACenv

surf now to http://localhost:8000/TRACenv

user ctrl+c to end tracd

Developing in virtualenv

to stop working on Trac enter:

deactivate

next time continue with

source ~/.virtualenv/trac/bin/activate

While developing we edit code in svn folder (e.g. ~/TOCmacro/) and install changes with

./setup.py develop