<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.mediagoblin.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nightsh</id>
	<title>GNU MediaGoblin Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.mediagoblin.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nightsh"/>
	<link rel="alternate" type="text/html" href="https://wiki.mediagoblin.org/Special:Contributions/Nightsh"/>
	<updated>2026-04-10T01:02:27Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.17</generator>
	<entry>
		<id>https://wiki.mediagoblin.org/index.php?title=HackingHowto&amp;diff=716</id>
		<title>HackingHowto</title>
		<link rel="alternate" type="text/html" href="https://wiki.mediagoblin.org/index.php?title=HackingHowto&amp;diff=716"/>
		<updated>2012-05-10T00:19:17Z</updated>

		<summary type="html">&lt;p&gt;Nightsh: SQLAlchemy required version bumped&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Hacking HOWTO =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== So you want to hack on GNU MediaGoblin? ==&lt;br /&gt;
&lt;br /&gt;
First thing to do is check out the [http://mediagoblin.org/join/ web site] where we list all the project&lt;br /&gt;
infrastructure including:&lt;br /&gt;
&lt;br /&gt;
* the IRC channel&lt;br /&gt;
* the mailing list&lt;br /&gt;
* the issue tracker&lt;br /&gt;
&lt;br /&gt;
Additionally, we have information on how to get involved, who to talk&lt;br /&gt;
to, what needs to be worked on, and other things besides!&lt;br /&gt;
&lt;br /&gt;
Second thing to do is take a look at [http://docs.mediagoblin.org/codebase.html codebase chapter] where&lt;br /&gt;
we&#039;ve started documenting how GNU MediaGoblin is built and how to add&lt;br /&gt;
new things.  If you&#039;re planning on contributing in python, you should be aware&lt;br /&gt;
of [http://www.python.org/dev/peps/pep-0008/ PEP-8], the official Python style guide,&lt;br /&gt;
which we follow.&lt;br /&gt;
&lt;br /&gt;
Third you&#039;ll need to get the requirements.&lt;br /&gt;
&lt;br /&gt;
Fourth, you&#039;ll need to build a development environment.  We use an&lt;br /&gt;
in-package checkout of virtualenv.  This isn&#039;t the convenional way to&lt;br /&gt;
install virtualenv (normally you don&#039;t install virtualenv inside the&lt;br /&gt;
package itself) but we&#039;ve found that it&#039;s significantly easier for&lt;br /&gt;
newcomers who aren&#039;t already familiar with virtualenv.  If you *are*&lt;br /&gt;
already familiar with virtualenv, feel free to just install&lt;br /&gt;
mediagoblin in your own virtualenv setup... the necessary adjustments&lt;br /&gt;
should be obvious.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Getting requirements ==&lt;br /&gt;
&lt;br /&gt;
First, you need to have the following installed before you can build&lt;br /&gt;
an environment for hacking on GNU MediaGoblin:&lt;br /&gt;
&lt;br /&gt;
* Python 2.6 or 2.7  - http://www.python.org/ (You&#039;ll need Python as well as the dev files for building modules.)&lt;br /&gt;
* python-lxml        - http://lxml.de/&lt;br /&gt;
* git                - http://git-scm.com/&lt;br /&gt;
* SQLAlchemy 0.7.0 or higher   - http://www.sqlalchemy.org/&lt;br /&gt;
* Python Imaging Library (PIL) - http://www.pythonware.com/products/pil/&lt;br /&gt;
* virtualenv         - http://www.virtualenv.org/&lt;br /&gt;
* Python GStreamer Bindings - http://gstreamer.freedesktop.org/modules/gst-python.html&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== GNU/Linux ===&lt;br /&gt;
&lt;br /&gt;
==== Debian and derivatives ====&lt;br /&gt;
&lt;br /&gt;
If you&#039;re running Debian GNU/Linux or a Debian-derived distribution&lt;br /&gt;
such as Debian, Mint, or [http://bugs.foocorp.net/issues/478 Ubuntu 10.10+], running the following should install these&lt;br /&gt;
requirements:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|sudo apt-get install git-core python python-dev python-lxml python-imaging python-virtualenv python-gst0.10 libjpeg8-dev}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Fedora / RedHat(?) ====&lt;br /&gt;
&lt;br /&gt;
On Fedora:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|yum install python-paste-deploy python-paste-script git-core python python-devel python-lxml python-imaging python-virtualenv gstreamer-python}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Mac OS X ===&lt;br /&gt;
&lt;br /&gt;
On Mac OS X Lion:&lt;br /&gt;
&lt;br /&gt;
Download the Newest Python.&lt;br /&gt;
&lt;br /&gt;
Git is already installed.&lt;br /&gt;
&lt;br /&gt;
Python-lxml: http://muffinresearch.co.uk/archives/2009/03/05/install-lxml-on-osx/ with sudo&lt;br /&gt;
&lt;br /&gt;
Python Imaging Library (PIL): http://code.google.com/appengine/docs/python/images/installingPIL.html#mac&lt;br /&gt;
&lt;br /&gt;
Libjpeg &amp;amp; Libpng: http://ethan.tira-thompson.org/Mac_OS_X_Ports.html Combo Installer&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;You can help:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have instructions for other GNU/Linux distributions, Windows, or Mac OS X to set&lt;br /&gt;
up requirements, let us know!&lt;br /&gt;
&lt;br /&gt;
== How to set up and maintain an environment for hacking with virtualenv ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Requirements&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
No additional requirements.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Create a development environment&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
After installing the requirements, follow these steps:&lt;br /&gt;
&lt;br /&gt;
* Clone the repository: {{Cmd|git clone &amp;lt;nowiki&amp;gt;git://gitorious.org/mediagoblin/mediagoblin.git&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
* Change directories to your new checkout: {{Cmd|cd mediagoblin}}&lt;br /&gt;
* Set up the in-package virtualenv:&lt;br /&gt;
  (virtualenv --system-site-packages . || virtualenv .) &amp;amp;&amp;amp; ./bin/python setup.py develop&lt;br /&gt;
* Init the database:&lt;br /&gt;
  {{Cmd|./bin/gmg dbupdate}}&lt;br /&gt;
&lt;br /&gt;
That&#039;s it!&lt;br /&gt;
&lt;br /&gt;
(If you have troubles in the remaining steps, consider try installing&lt;br /&gt;
virtualenv with one of the flags --setuptools, --distribute or possibly --no-site-packages.  Additionally, if your system has python3.X as the default, you might need to do virtualenv --python=python2.7 or --python=python2.6)&lt;br /&gt;
&lt;br /&gt;
If you have problems, please [http://mediagoblin.org/join/ let us know]!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Updating an existing environment ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Updating for dependency changes&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
While hacking on GNU MediaGoblin over time, you&#039;ll eventually have to&lt;br /&gt;
update your development environment because the dependencies have&lt;br /&gt;
changed.&lt;br /&gt;
&lt;br /&gt;
To do that, run:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|./bin/python setup.py develop --upgrade &amp;amp;&amp;amp; ./bin/gmg dbupdate}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Updating for code changes&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{{Cmd|git pull -u}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running the server ==&lt;br /&gt;
&lt;br /&gt;
If you want to get things running quickly and without hassle, just&lt;br /&gt;
run:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|./lazyserver.sh}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will start up a python server where you can begin playing with&lt;br /&gt;
mediagoblin, listening on 127.0.0.1:6543.  It will also run celery in &amp;quot;always eager&amp;quot; mode so you&lt;br /&gt;
don&#039;t have to start a separate process for it.&lt;br /&gt;
&lt;br /&gt;
By default, the instance is not sending out confirmation mails. Instead they are redirected to the standard output (the console) of lazyserver.sh.&lt;br /&gt;
&lt;br /&gt;
You can change this behavior setting &amp;lt;code&amp;gt;email_debug_mode&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; in mediagoblin.ini&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is fine in development, but if you want to actually run celery&lt;br /&gt;
separately for testing (or deployment purposes), you&#039;ll want to run&lt;br /&gt;
the server independently:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|./bin/paster serve paste.ini --reload}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running celeryd ==&lt;br /&gt;
&lt;br /&gt;
If you aren&#039;t using &amp;lt;tt&amp;gt;./lazyserver.sh&amp;lt;/tt&amp;gt; or otherwise aren&#039;t running celery&lt;br /&gt;
in always eager mode, you&#039;ll need to do this if you want your media to&lt;br /&gt;
process and actually show up.  It&#039;s probably a good idea in&lt;br /&gt;
development to have the web server (above) running in one terminal and&lt;br /&gt;
celeryd in another window.&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;CELERY_CONFIG_MODULE=mediagoblin.init.celery.from_celery ./bin/celeryd&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running the test suite ==&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|./runtests.sh}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running a shell ==&lt;br /&gt;
&lt;br /&gt;
If you want a shell with your database pre-setup and an instantiated&lt;br /&gt;
application ready and at your fingertips....&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|./bin/gmg shell}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Problems with PIL ===&lt;br /&gt;
&lt;br /&gt;
Some users have claimed they&#039;ve had trouble with PIL working nicely on their system.  You could try installing Pillow:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|./bin/pip install pillow}}&lt;br /&gt;
&lt;br /&gt;
... note that we don&#039;t &amp;quot;officially&amp;quot; support pillow at this time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Wiping your user data ==&lt;br /&gt;
&lt;br /&gt;
You can completely wipe all data from the instance by doing:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|rm -rf mediagoblin.db kombu.db celery.db user_dev; ./bin/gmg dbupdate}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Unless you&#039;re doing development and working on and testing creating&lt;br /&gt;
a new instance, you will probably never have to do this.&lt;br /&gt;
&lt;br /&gt;
== Quickstart for Django programmers ==&lt;br /&gt;
&lt;br /&gt;
We&#039;re not using Django, but the codebase is very Django-like in its&lt;br /&gt;
structure.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;routing.py&amp;lt;/tt&amp;gt; is like &amp;lt;tt&amp;gt;urls.py&amp;lt;/tt&amp;gt; in Django&lt;br /&gt;
* &amp;lt;tt&amp;gt;models.py&amp;lt;/tt&amp;gt; has SQLAlchemy ORM definitions&lt;br /&gt;
* &amp;lt;tt&amp;gt;views.py&amp;lt;/tt&amp;gt; is where the views go&lt;br /&gt;
&lt;br /&gt;
We&#039;re using SQLAlchemy, which is semi-similar to the Django ORM, but&lt;br /&gt;
not really because you can get a lot more fine-grained.  The&lt;br /&gt;
[http://docs.sqlalchemy.org/en/latest/orm/tutorial.html SQLAlchemy ORM tutorial] is a great place to start.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;YouCanHelp&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If there are other things that you think would help orient someone&lt;br /&gt;
new to GNU MediaGoblin but coming from Django, let us know!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bite-sized bugs to start with ==&lt;br /&gt;
&lt;br /&gt;
Now you should visit our latest list of [http://issues.mediagoblin.org/query?status=!closed&amp;amp;keywords=~bitesized bite-sized issues] because squishing bugs is messy fun. If you&#039;re interested in other things to work on, or need help getting started on a bug, let us know on [http://mediagoblin.org/join/ the mailing list] or on the [http://mediagoblin.org/join/ IRC channel].&lt;/div&gt;</summary>
		<author><name>Nightsh</name></author>
	</entry>
</feed>