<?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=MelmothX</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=MelmothX"/>
	<link rel="alternate" type="text/html" href="https://wiki.mediagoblin.org/Special:Contributions/MelmothX"/>
	<updated>2026-05-19T10:24:42Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.17</generator>
	<entry>
		<id>https://wiki.mediagoblin.org/index.php?title=HackingHowto&amp;diff=269</id>
		<title>HackingHowto</title>
		<link rel="alternate" type="text/html" href="https://wiki.mediagoblin.org/index.php?title=HackingHowto&amp;diff=269"/>
		<updated>2011-09-21T16:46:18Z</updated>

		<summary type="html">&lt;p&gt;MelmothX: /* Running the server */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Needswork}}&lt;br /&gt;
&lt;br /&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 :ref:`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.&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 buildout,&lt;br /&gt;
but if you want to use virtualenv, there&#039;s a set of mediocre not-very-supported&lt;br /&gt;
steps in the [https://gitorious.org/mediagoblin/pages/Home evil wiki].&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;
* MongoDB            - http://www.mongodb.org/&lt;br /&gt;
* Python Imaging Library (PIL) - http://www.pythonware.com/products/pil/&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 mongodb git-core python python-dev python-lxml python-imaging}}&lt;br /&gt;
&lt;br /&gt;
On Fedora:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|yum install mongodb-server python-paste-deploy python-paste-script git-core python python-devel python-lxml python-imaging}}&lt;br /&gt;
&lt;br /&gt;
----&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;
Install MongoDB from these instructions: http://www.mongodb.org/display/DOCS/Quickstart+OS+X&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;
&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 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 buildout ==&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;
# Bootstrap and run buildout: {{Cmd|cd mediagoblin}} and then one of the following:&lt;br /&gt;
#* {{Cmd|python bootstrap.py &amp;amp;&amp;amp; ./bin/buildout}}, &#039;&#039;&#039;OR&#039;&#039;&#039;&lt;br /&gt;
#* {{Cmd|python bootstrap.py --distribute &amp;amp;&amp;amp; ./bin/buildout}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Why would you want one over the other?  If the first doesn&#039;t work, then try the second.&lt;br /&gt;
&lt;br /&gt;
That&#039;s it!  Using this method, buildout should create a &amp;lt;tt&amp;gt;user_dev&amp;lt;/tt&amp;gt;&lt;br /&gt;
directory, in which certain things will be stored (media, beaker&lt;br /&gt;
session stuff, etc).  You can change this, but for development&lt;br /&gt;
purposes this default should be fine.&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;
&#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/buildout &amp;amp;&amp;amp; ./bin/gmg migrate}}.&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;
You don&#039;t need to do anything---code changes are automatically available.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Deleting your buildout&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
At some point, you may want to delete your buildout.  Perhaps it&#039;s to&lt;br /&gt;
start over.  Perhaps it&#039;s to test building development environments&lt;br /&gt;
with buildout.&lt;br /&gt;
&lt;br /&gt;
To do this, run:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|rm -rf bin develop-eggs eggs mediagoblin.egg-info parts user_dev}}.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Mongo Database ==&lt;br /&gt;
&lt;br /&gt;
Startup the Database: {{Cmd|./mongodb-xxxxxxx/bin/mongod}}.&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.  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;
== 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;
=== pymongo.errors.AutoReconnect: could not find master/primary ===&lt;br /&gt;
&lt;br /&gt;
If you see this:&lt;br /&gt;
&lt;br /&gt;
    pymongo.errors.AutoReconnect: could not find master/primary&lt;br /&gt;
&lt;br /&gt;
then make sure mongodb is installed and running.&lt;br /&gt;
&lt;br /&gt;
If it&#039;s installed, check the mongodb log.  On my machine, that&#039;s &lt;br /&gt;
&amp;lt;tt&amp;gt;/var/log/mongodb/mongodb.log&amp;lt;/tt&amp;gt;.  If you see something like:&lt;br /&gt;
&lt;br /&gt;
    old lock file: /var/lib/mongodb/mongod.lock.  probably means...&lt;br /&gt;
&lt;br /&gt;
in that case you might have had an unclean shutdown.  Try:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|sudo mongod --repair}}&lt;br /&gt;
&lt;br /&gt;
If that didn&#039;t work, just delete the lock file and relaunch mongodb.&lt;br /&gt;
&lt;br /&gt;
Anyway, then start the mongodb server in whatever way is appropriate&lt;br /&gt;
for your distro / OS.&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|gmg wipealldata}}&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.  Will&lt;br /&gt;
plans to do this work and thus he documented it.&lt;br /&gt;
&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 mongokit 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 MongoDB.  Basically, instead of a relational database with&lt;br /&gt;
tables, you have a big JSON structure which acts a lot like a Python&lt;br /&gt;
dict.&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://bugs.foocorp.net/projects/mediagoblin/issues?query_id=3 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>MelmothX</name></author>
	</entry>
</feed>