Merge branch 'master' into celerysubmit
[mediagoblin.git] / docs / hackinghowto.rst
CommitLineData
5a40e1ec
WKG
1.. _hacking-howto:
2
00fdc7bd
WKG
3===============
4 Hacking HOWTO
5===============
6
5a40e1ec
WKG
7
8So you want to hack on GNU MediaGoblin?
9=======================================
56d507b6 10
9d952fdc
WKG
11First thing to do is check out the `Web site
12<http://mediagoblin.org>`_ where we list all the project
13infrastructure including:
56d507b6
WKG
14
15* the mailing list
16* the IRC channel
17* the bug tracker
18
19Additionally, we have information on how to get involved, who to talk
20to, what needs to be worked on, and other things besides!
21
22
c66d0f5c
WKG
23How to set up and maintain an environment for hacking
24=====================================================
56d507b6 25
56d507b6 26
c66d0f5c
WKG
27Getting requirements
28--------------------
56d507b6 29
c66d0f5c
WKG
30First, you need to have the following installed before you can build
31an environment for hacking on GNU MediaGoblin:
56d507b6 32
c66d0f5c 33* Python 2.6 or 2.7 - http://www.python.org/
56d507b6 34
c66d0f5c 35 You'll need Python as well as the dev files for building modules.
56d507b6 36
c66d0f5c
WKG
37* python-lxml - http://lxml.de/
38* git - http://git-scm.com/
39* MongoDB - http://www.mongodb.org/
40
41If you're running Debian GNU/Linux or a Debian-derived distribution
42such as Mint or Ubuntu, running the following should install these
43requirements::
44
5740a0d6
WKG
45 sudo apt-get install mongodb git-core python python-dev \
46 python-lxml
c66d0f5c
WKG
47
48
49Running bootstrap and buildout
50------------------------------
51
52After installing the requirements, follow these steps:
53
541. Clone the repository::
55
56 git clone http://git.gitorious.org/mediagoblin/mediagoblin.git
56d507b6 57
719f82ba 582. Bootstrap and run buildout::
56d507b6 59
c66d0f5c
WKG
60 cd mediagoblin
61 python bootstrap.py && ./bin/buildout
62
63
64That's it! Using this method, buildout should create a ``user_dev``
65directory, in which certain things will be stored (media, beaker
66session stuff, etc). You can change this, but for development
67purposes this default should be fine.
68
69
70.. Note::
71
72 We used `zc.buildout <http://www.buildout.org/>`_ because it
73 involves fewer steps to get things running and less knowledge of
74 Python packaging. However, if you prefer to use `virtualenv
75 <http://pypi.python.org/pypi/virtualenv>`_, that should work just
76 fine.
56d507b6
WKG
77
78
c66d0f5c
WKG
79Updating dependencies
80---------------------
56d507b6 81
c66d0f5c 82While hacking on GNU MediaGoblin over time, you'll eventually have to
5740a0d6 83update your development environment. To do that, run::
56d507b6 84
c66d0f5c 85 ./bin/buildout
56d507b6
WKG
86
87
5740a0d6
WKG
88Wiping your environment for a clean-slate
89-----------------------------------------
90
9d952fdc
WKG
91.. Note::
92
93 Unless you're doing development and working on and testing creating
94 a new instance, you will probably never have to do this. Will
95 plans to do this work and thus he documented it.
96
97
5740a0d6
WKG
98Delete the following directories:
99
100* bin/
101* develop-eggs/
102* eggs/
103* mediagoblin.egg-info/
104* parts/
105* user_dev/
106
9d952fdc
WKG
107FIXME - how to drop data from mongodb? we should probably write a
108script.
5740a0d6
WKG
109
110
dae6add9
CAW
111Running the server
112==================
113
114Run::
115
c66d0f5c 116 ./bin/paster serve mediagoblin.ini --reload
dae6add9
CAW
117
118
56d507b6
WKG
119Running the test suite
120======================
121
122Run::
123
c66d0f5c 124 ./bin/nosetests
56d507b6
WKG
125
126
5740a0d6
WKG
127What's where
128============
129
130After you've run buildout, you're faced with the following directory
131tree::
132
133 mediagoblin/
134 |- mediagoblin/ source code
135 | |- tests/
136 | |- templates/
137 | |- auth/
138 | \- submit/
139 |- docs/ documentation
140 |
141 | the rest of these directories are generated by
142 | buildout.
143 |
144 |- bin/ scripts
145 |- develop-eggs/
146 |- eggs/
147 |- mediagoblin.egg-info/
148 |- parts/
149 |- user_dev/ sessions, etc
150
151
152
5a40e1ec
WKG
153Quickstart for Django programmers
154=================================
155
156FIXME - write this
157
158
159Bite-sized bugs to start with
160=============================
161
162FIXME - write this
9d952fdc
WKG
163
164
165Tips for people new to coding
166=============================
167
168Python
169------
170
171GNU MediaGoblin is written using a programming language called `Python
172<http://python.org/>`_.
173
174There are two different incompatible iterations of Python which I'll
175refer to as Python 2 and Python 3. GNU MediaGoblin is written in
176Python 2 and requires Python 2.6 or 2.7. At some point, we might
177switch to Python 3, but that's a future thing.
178
179You can learn how to code in Python 2 from several excellent books
180that are freely available on the Internet:
181
182* `Learn Python the Hard Way <http://learnpythonthehardway.org/>`_
183* `Dive Into Pyton <http://diveintopython.org/>`_
184* `Python for Software Design <http://www.greenteapress.com/thinkpython/>`_
185* `A Byte of Python <http://www.swaroopch.com/notes/Python>`_
186
187These are all excellent texts.
188
189FIXME - are there good quality Python tutorial videos?
190
191
192Libraries
193---------
194
195GNU MediaGoblin uses a variety of libraries in order to do what it
196does. These libraries are listed in the :ref:`beardomatic-chapter`
197along with links to the project Web sites and documentation for the
198libraries.
199
200There are a variety of Python-related conferences every year that have
201sessions covering many aspects of these libraries. You can find them
202at `Python Miro Community <http://python.mirocommunity.org>`_ [0]_.
203
204.. [0] This is a shameless plug. Will Kahn-Greene runs Python Miro
205 Community.
206
207If you have questions or need help, find us on the mailing list and on
208IRC.