| 1 | = Developer setup for Trac = |
| 2 | This tutorial assumes you have SVN installed. If you don't please go to the [http://subversion.tigris.org/ Subversion] website and follow the directions of installation there. |
| 3 | |
| 4 | == Setting up the environment == |
| 5 | Before we begin to develop in Trac, or even download Trac code, lets create a standalone environment. |
| 6 | |
| 7 | === Create a working directory === |
| 8 | No matter my operating system, I like to create a projects or working directory for my development efforts. So for example on some systems, I might have: |
| 9 | {{{ |
| 10 | /Users/myname/projects |
| 11 | }}} |
| 12 | On Windows I would have: |
| 13 | {{{ |
| 14 | c:\projects |
| 15 | }}} |
| 16 | |
| 17 | '''Note:''' I don't create a directory called 'trac' yet. That comes later! In the meantime, cd (change directory) to your projects directory. |
| 18 | |
| 19 | === Get easy_install === |
| 20 | Go to [http://peak.telecommunity.com/DevCenter/EasyInstall#installing-easy-install installing-easy-install] and follow the instructions there. However, most of the time you just take the text at [http://peak.telecommunity.com/dist/ez_setup.py ez_setup.py], save it as ez_setup.py on your hard drive, then from the command-line prompt type: |
| 21 | {{{ |
| 22 | python ez_setup.py |
| 23 | }}} |
| 24 | |
| 25 | === Get virtual env === |
| 26 | From the command-line prompt type: |
| 27 | {{{ |
| 28 | easy_install virtualenv |
| 29 | }}} |
| 30 | |
| 31 | === Set up a virtual environment === |
| 32 | From the command-line prompt type: |
| 33 | {{{ |
| 34 | virtualenv trac |
| 35 | cd trac |
| 36 | source bin/activate |
| 37 | }}} |
| 38 | |
| 39 | You'll see your command-line prompt has changed. That means our environment is ready for Trac. |
| 40 | |
| 41 | === Downloading trac === |
| 42 | From the command-line prompt: |
| 43 | {{{ |
| 44 | svn co http://svn.edgewall.org/repos/trac/trunk/ trac-trunk |
| 45 | svn co http://svn.edgewall.org/repos/genshi/trunk/ genshi-trunk |
| 46 | cd trac-trunk |
| 47 | python setup.py develop |
| 48 | cd ../genshi-trunk |
| 49 | python setup.py develop |
| 50 | cd .. |
| 51 | }}} |
| 52 | |
| 53 | === Creating your test trac environment === |
| 54 | From the command-line prompt: |
| 55 | {{{ |
| 56 | trac-admin test initenv |
| 57 | ... abount installation |
| 58 | trac-admin test permission add anonymous TRAC_ADMIN |
| 59 | }}} |
| 60 | |
| 61 | === Installing the trackdeveloperplugin === |
| 62 | From the command-line prompt: |
| 63 | {{{ |
| 64 | svn co http://trac-hacks.org/svn/tracdeveloperplugin/trunk/ tracdeveloperplugin |
| 65 | cd tracdeveloperplugin |
| 66 | python setup.py bdist_egg |
| 67 | cp dist/*.egg ../test/plugins |
| 68 | cd .. |
| 69 | }}} |
| 70 | |
| 71 | === Starting trac in development mode === |
| 72 | From the command-line prompt: |
| 73 | {{{ |
| 74 | tracd -r --port 8000 test |
| 75 | }}} |
| 76 | |
| 77 | '''note''': The -r command puts Trac into refresh mode so your code changes will show up quickly. |
| 78 | |
| 79 | |
| 80 | |
| 81 | === Web stuff === |
| 82 | Switch to your browser and go to this URL: |
| 83 | |
| 84 | http://127.0.0.1:8000/test |
| 85 | |
| 86 | Now lets follow a few more steps |
| 87 | |
| 88 | * Go to web admin |
| 89 | * Hit the admin link |
| 90 | * Logging |
| 91 | - Set type to console |
| 92 | - level to debug |