0👍
✅
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^polls/',include('myapp.urls', namespace="myapp")),
)
------------------------------------------------------------
django.conf.urls import patterns, url
urlpatterns=patterns('myapp.views',
url(r'^$','index', name='index')
)
1👍
I think you have already done that with line
url(r'^polls/',include('mysite.myapp.urls')),
in your mysite/urls.py. The index
view will be visible on url http://yourserver/polls/
I’m hoping you have fixed python path appropriate so that imports like from mysite.myapp.views import index
works well. If not you can fix them as from myapp.views import index
.
And then update the urls.py as
url(r'^polls/',include('myapp.urls')),
Source:stackexchange.com