Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated the docs for writing new training missions #302

Merged
merged 2 commits into from Jul 21, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 15 additions & 8 deletions docs/tutorials/writing_missions.rst
Expand Up @@ -181,20 +181,27 @@ Making it Accessible
--------------------

The final step to writing your Mission is to make it accessible on the
site. This requires 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. If you open it, you'll find
a list of URL patterns -- regular expressions which Django will use to
match URLs and figure out where to send requests. You can add the new
mission by adding a new item after the other missions::
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::

import mysite.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::

(r'^missions/makeamission',
include(mysite.missions.makeamission.views.MakeAMission.urls())),

Two important things to note:

* ``makeamission`` in the ``include`` statement refers to the
directory you created, so you'll need to make sure the name matches.
* ``makeamission`` in the ``include`` and ``import`` statements above refer
to the directory you created, so you'll need to make sure the name matches.
* ``MakeAMission`` is the name you give your Mission class.

Once you've added it to the URLs, you can start the server and visit
Expand Down