2

New to Django. I have followed the tutorial and have mysite/ where manage.py is located, and mysite/mysite where settings, urls, etc are. Also have mysite/polls from the tutorial.

I'm adding a second "app" called blist. Ran startapp and created the skeleton under mysite/blist

here is the mysite/urls.py

from django.conf.urls import patterns, include, url

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
url(r'^polls/', include('polls.urls', namespace="polls")),
url(r'^blist/', include('list.urls', namespace="blist")),
url(r'^admin/', include(admin.site.urls)),
)

When I try to go to localhost:8000/list it redirects to /polls. I know I'm missing something silly but I figured I'd ask you guys.

here's mysite/blist/urls.py

from django.conf.urls import patterns, url

from polls import views

urlpatterns = patterns('',
url(r'^$', views.IndexView.as_view(), name='index'),
)

here's mysite/polls/urls.py

from django.conf.urls import patterns, url

from polls import views

urlpatterns = patterns('',
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^(?P<pk>\d+)/$', views.DetailView.as_view(), name='detail'),
url(r'^(?P<pk>\d+)/results/$', views.ResultsView.as_view(), name='results'),
url(r'^(?P<poll_id>\d+)/vote/$', views.vote, name='vote'),
)

Here's the Installed_apps stanza

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'polls',
'blist',
)

Thanks, Dale

4
  • 1
    Could you please show your polls/urls.py and list/urls.py?
    – alecxe
    Jan 15, 2014 at 16:23
  • you will want to make sure that 'list' is in the INSTALLED_APPS list in settings.py
    – imandrewd
    Jan 15, 2014 at 16:27
  • On a side note, list is a python builtin. it is a bad idea to use that for an app name
    – karthikr
    Jan 15, 2014 at 16:44
  • Yeah...I actually typed in the code as it was on a different system and I was too lazy to login and copy paste....it's blist not list. I've corrected post...good catch.
    – Dale
    Jan 15, 2014 at 18:09

2 Answers 2

1

Ugg! I figured it out. I did the cut and paste thing from polls/urls.py and failed to change the

from polls import views

to

from blist import views

Sorry to bother.

1
  • You told it was a redirection. Was it the redirection?
    – sergzach
    Jan 16, 2014 at 9:41
0
url(r'^blist/', include('list.urls', namespace="blist")),

You might want to edit that one, because it says

include('list.url')

In my opinion changing it to

include('blist.url')

and keeping everything else the same might the app run perfectly.

1
  • Please read How to Answer - You should format your code properly and please don't use "txt spk" and slang abbreviations like 'wanna'.
    – Ajean
    Jun 9, 2017 at 23:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.