Skip to content

Instantly share code, notes, and snippets.

@kaidokert
Created May 3, 2015 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaidokert/6d8a25769544d6c4b12c to your computer and use it in GitHub Desktop.
Save kaidokert/6d8a25769544d6c4b12c to your computer and use it in GitHub Desktop.
Minimal django to serve a html page
import sys
from django.conf.urls import url
from django.core.wsgi import get_wsgi_application
from django.http import HttpResponse
from django.conf import settings
settings.configure(
DEBUG='on',
ROOT_URLCONF=__name__,
)
def index(request):
return HttpResponse(
'<!doctype html><html lang=en>'
'<head><meta charset=utf-8>'
'<title>%s</title></head>'
'<body><p>%s</p></body>'
'</html>' % ('title', 'content')
)
urlpatterns = (
url(r'^$', index),
)
application = get_wsgi_application()
if __name__ == "__main__":
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment