django view for http://127.0.0.1:8000/

Viewed 3380

I've already searched for my topic but the results were showed fixes for e.g. 127.0.0.1:8000/polls, 127.0.0.1:8000/app_xy etc. but nor for 127.0.0.1:8000 direct. I want my Homepage show view-result e. g. "This is my homepage" if I call it with 127.0.0.1:8000 My idea is to edit my website's main-urls.py (myWebsite/urls.py) with the following line:

urlpatterns = [
url(r'^$', <no idea what to do here>),

url(r'^app2/', include('app2.urls')),
url(r'^polls/', include('polls.urls')),
url(r'^admin/', admin.site.urls),

]

I created a view (myWebsite/views.py) which contains:

from django.shortcuts import render
from django.http import HttpResponse
def index(request):
     return HttpResponse('Hello from the Homepage')

I had no problems with the views of the apps (app2, polls) and they work fine, but I don't know how to call the view above from the main-urls.py. Or what do you advise me to do?

I hope I explained my problem well enough.

Thx for your help.

1 Answers
Related