Skip to content
ekampf edited this page Sep 6, 2010 · 3 revisions

Getting Started

Routes

In Ignition, a route is an Python decorator that matches an HTTP method and a URL pattern to a view function:

	@get('/')
	def index(request):
		... show something ...

	@post('/')
	def index(request):
		... create something ...

	@put('/')
	def index(request):
		... update something ...

	@delete('/')
	def index(request):
		... destroy something ...

Routes are matched in the order in which they are defined. The first route that matches the request is invoked.

Route patterns can include names:

@get('/{year:\d\d\d\d}/{month:\d\d}/'')
def index(request, year, month):
   return "Hello from the year %s" % year

Halting

To immediately stop a request use:

halt()

You can also specify the status, explanation and response headers when halting:

halt(code=401, explanation="Get outta here!", headers=[('Content-Type', 'text/html'), ])

Passing

Configuration

Error Handling

Not Found

Error

More

Clone this wiki locally