Create Home Page for Django App

Home page for Django app

Open the settings file and add the app to the list of installed apps.



Open the main file under the <project>/ and add the url configuration.


urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^admin/', include(,

If a user navigates to our home page, Django should look for the index function located in the home view. In order for Django to know that the view exists, add the following at the top of your file


from <app> import views

Under the file under the <app> folder – Add the following


from django.shortcuts import render_to_response
from django.template import RequestContext

def index(request):
return render_to_response('<app>/index.html', context_instance=RequestContext(request))

Now make a template for home page (index)


<html lang="en">
<title>My Home Page</title>
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/style.css" media="screen" />

<p>My Content</p>