I am writing a GUI application using Django 1.1.1.
This is the views.py:
from django.http import HttpResponse
def mainpage(request):
f=open('pages/index.html','r').readlines()
out=''''''
for line in file:
out+=line
print out
return HttpResponse(out)
I am trying to load the contents of index.html which is inside a folder pages inside the GUI application folder.
My project's urls.py is
from django.conf.urls.defaults import *
from gui.views import *
urlpatterns = patterns('',
(r'^/$', mainpage)
)
When I run the server I get a 404 error for the root site. How can I load the index.html file through views?