I’m writing my third django app using the tutorial https://docs.djangoproject.com/en/dev/intro/tutorial03/ and i’m having trouble mapping an URLconf to another URLconf .
I am going to try and explain my problem as clear as I can .
I have an mysite directory and app directory which I called myapp inside the mysite directory.I am trying to point URLconf of the mysite directory to the URLconf of the myapp directory. Once it’s pointed it will execute an ‘hello’ from the myapp view.py.
The path are :
home/superman/mysite
and my myapp path is
home/superman/mysite/myapp
My urls.conf for mysite is
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^polls/',include('mysite.myapp.urls')),
)
My view.py inside myapp are
from django.http import HttpResponse
def index(request):
return HttpResponse("hello")# Create your views here.
My urls.py inside myapp are
django.conf.urls import patterns,url
from mysite.myapp.views import index
urlpatterns=patterns('',
url(r'^$',index, name'index')
)
Thank you for helping me
1 Answer