Skip to content

Instantly share code, notes, and snippets.

@simonw
Created July 16, 2015 01:20
Show Gist options
  • Select an option

  • Save simonw/68662325b25dff560517 to your computer and use it in GitHub Desktop.

Select an option

Save simonw/68662325b25dff560517 to your computer and use it in GitHub Desktop.
A django view in a single file, adapted from https://raw.githubusercontent.com/halfnibble/django-light/master/hello.py
from django.conf import settings
from django.http import HttpResponse
from django.conf.urls import url
settings.configure(
DEBUG = True,
SECRET_KEY = 'yourrandomsecretkey',
ROOT_URLCONF = __name__,
MIDDLEWARE_CLASSES = (),
)
urlpatterns = (
url(r'^$', lambda request: HttpResponse('Hello!')),
)
if __name__ == '__main__':
from django.core.management import execute_from_command_line
import sys
execute_from_command_line(sys.argv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment