Skip to content
Latest commit 62239fe Oct 23, 2012 @aclark4life Wording
Failed to load latest commit information.
hello Wording Oct 23, 2012
README.rst Wording Oct 23, 2012
requirements.txt Add lib Oct 23, 2012
setup.py Rename Oct 23, 2012

README.rst

Hello Django

This is what Hello World in Django looks like to me.

setup.py:

from setuptools import setup

setup(
    name='hello',
)

requirements.txt:

Django==1.4.1
-e .

settings.py:

from hello import urls


DEBUG = True
ROOT_URLCONF = urls

urls.py:

from django.conf.urls import patterns

urlpatterns = patterns(
    '',
    (r'', 'hello.views.index'),
)

views.py:

from django.http import HttpResponse
import datetime


# Based on https://docs.djangoproject.com/en/1.4/topics/http/views/
def index(request):
    """
    This function takes a Django request object and returns a 'Hello World'
    style response, by wrapping some HTML in a Django response object.
    """

    now = datetime.datetime.now()
    html = "<html><body>It is now %s.</body></html>" % now
    return HttpResponse(html)

Installation

To install:

$ git clone this-repo
$ cd this-repo
$ virtualenv .
$ bin/pip install -r requirements.txt
$ bin/django-admin.py runserver --settings=hello.settings
Something went wrong with that request. Please try again.