I want to write a very small Django application in a single file, requiring all the appropriate modules and stuff, and then be able to run that as a normal Python script, li
Getting started with Django can be pretty easy too. Here's a 10-line single-file Django webapp:
import os
from django.conf.urls.defaults import patterns
from django.http import HttpResponse
filepath, extension = os.path.splitext(__file__)
ROOT_URLCONF = os.path.basename(filepath)
def yoohoo(request):
return HttpResponse('Yoohoo!')
urlpatterns = patterns('', (r'^hello/$', yoohoo))
Check out my blog post Minimal Django for details.