Last active
March 16, 2018 09:36
-
-
Save yakky/2379f914b4eba97ae134fb3f7eb20aac to your computer and use it in GitHub Desktop.
Micro hello world Python Web Framework Royal Rumble @PyCon 7
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 django | |
DEBUG, ROOT_URLCONF, DATABASES, SECRET_KEY = 1, 'pico', {'default': {}}, 'p' | |
urlpatterns = [django.conf.urls.url(r'^(?P<name>\w+)?$', lambda request, | |
name: django.http.HttpResponse('hello %s!' % (name or 'world')))] |
s/ejoy/enjoy/
and now I am a contributor to the weirdest Django project ever \o/
This is great. You can cut it down to 250 characters if you just import django
instead:
import django
DEBUG, ROOT_URLCONF, DATABASES, SECRET_KEY = 1, 'pico', {'default': {}}, 'p'
urlpatterns = [django.conf.urls.url(r'^(?P<name>\w+)?$', lambda request, name: django.http.HttpResponse(
'hello {name}!'.format(name=(name or 'world'))))]
Update to your suggestion (edited a bit to fit 80 chars lines which was one of the constraints)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can run this using
django-admin runserver --settings=pico
and ejoy a django "hello world!"