Created
May 3, 2015 19:20
-
-
Save kaidokert/6d8a25769544d6c4b12c to your computer and use it in GitHub Desktop.
Minimal django to serve a html page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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