Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 hello
Octocat-spinner-32 README.rst
Octocat-spinner-32 requirements.txt
Octocat-spinner-32 setup.py
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.