Training Missions are tools which help people learn the skills needed
to contribute to open source projects without burning their fingers.
They can be background information (Windows Setup), or more
involved (Subversion Training, which creates repositories for each
user to work on).

Missions are made up of some Python code (“views”), and some HTML
(“templates”). OpenHatch uses some conventions to make developing new
training missions as simple as possible.

Note

This document currently covers Simple (non-interactive) Training
Missions. We are working to update it to describe interactive
missions, as well.

Simple Training Missions provide users with step by step
documentation. As an example we’ll start a new mission to document how
to make missions (how meta!), cunningly named “Make a Mission”.

To begin developing a new mission, we need to create two directories:
one for the mission code, and one for the mission templates. Both are
stored in sub-directories of the OpenHatch repository
(oh-mainline; see Getting Started for more information).

The first directory we create is the code directory. The second is the
template directory.

It will help other developers work on your code if you use the same
name for both directories. Note that we’re making directories named
makeamission, not “Make a Mission”. That’s because the directory
name needs to be a valid Python package name, which means no spaces or
non-alphanumeric characters.

Within the code directory (makeamission), you’ll need
to create an empty file named __init__.py; this tells Python that
this directory is a package. On Mac OS X and Linux, you can do this
by running the touch command:

$ touch makeamission/__init__.py

On Windows, just create the file with your favorite (or second
favorite) text editor.

The first line tells OpenHatch that this page should be based on the
common Mission template.

{{title}} and {{next_step_url}} are substitutions:
Mission views provide several conveniences so you don’t have to
repeat yourself. These include title (the step title),
next_step_url (the URL of the next step), and prev_step_url
(the URL of the previous step).

The template for the second step should be named steptwo.html,
which is what you specified in the class (StepTwo) above.

The final step to writing your Mission is to make it accessible on the
site by telling OpenHatch how to route the URLs. Django projects define
URL routing in a file cunningly named urls.py. You can find this
in the mysite directory. You can begin by opening urls.py.
You’ll need to tell it where the file views.py for your new mission
lives by adding an import statement near the top of urls.py right
after the import statements for the existing training missions like so:

importmysite.missions.makeamission.views

In urls.py, you’ll also find a list of URL patterns – regular
expressions which Django will use to match URLs and figure out where to
send requests. Finally, add the new mission by adding a new item after the
other missions: