Django can't find any views but index
Question: I'm pretty new to Python and Django as well, but I'm going through the
tutorial as closely as I can and I must be missing something. I can get my
default index view to load, but I want to send an ajax call to a view called
'search' and I have another view called 'show' that would take an integer
(show_id) and I get 404s on both of the calls to those pages.

What am I missing? Do I need anything else in my settings? My index view works
fine, but these other routes aren't jiving. Thanks for the help in advance!

EDIT: Here is a screengrab of my folder structure: ![enter image description
here](http://i.stack.imgur.com/B35mC.png)

mediamanager/urls.py:

    
    
    from django.conf.urls import patterns, include, url
    from django.contrib import admin
    
    urlpatterns = patterns('',
        # Examples:
        # url(r'^$', 'mediamanager.views.home', name='home'),
        # url(r'^blog/', include('blog.urls')),
    
        url(r'^manager', include('manager.urls')),
        url(r'^admin/', include(admin.site.urls))
    )
    

Settings:

    
    
    # SECURITY WARNING: don't run with debug turned on in production!
    DEBUG = True
    
    TEMPLATE_DEBUG = True
    
    ALLOWED_HOSTS = []
    
    
    # Application definition
    
    INSTALLED_APPS = (
        'django.contrib.admin',
        'django.contrib.auth',
        'django.contrib.contenttypes',
        'django.contrib.sessions',
        'django.contrib.messages',
        'django.contrib.staticfiles',
        'manager'
    )
    
    MIDDLEWARE_CLASSES = (
        'django.contrib.sessions.middleware.SessionMiddleware',
        'django.middleware.common.CommonMiddleware',
        'django.middleware.csrf.CsrfViewMiddleware',
        'django.contrib.auth.middleware.AuthenticationMiddleware',
        'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
        'django.contrib.messages.middleware.MessageMiddleware',
        'django.middleware.clickjacking.XFrameOptionsMiddleware',
    )
    
    ROOT_URLCONF = 'mediamanager.urls'
    
    WSGI_APPLICATION = 'mediamanager.wsgi.application'
    
    
    # Database
    # https://docs.djangoproject.com/en/1.7/ref/settings/#databases
    
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.sqlite3',
            'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
        }
    }
    

manager.urls.py:

    
    
    from django.conf.urls import patterns, url
    
    from manager import views
    
    urlpatterns = patterns('',
        url(r'^$',views.index, name='index'),
        url(r'^(?P<show_id>\d+)/$', views.show, name='show'),
        url(r'^search/$', views.search, name='search')
    )
    

views.py

    
    
    from django.shortcuts import render
    from django.http import HttpResponse
    from manager.models import Show, Episode
    import urllib2
    
    
    # Create your views here.
    def index(request):
        context = {'shows' : Show.objects.all().order_by('show_name')}
        return render(request, 'manager/index.html', context)
    
    
    def show(request, show_id):
        s = Show.objects.get(show_id).order_by('-air_date')
        context = {'show': s, 'episodes': s.episodes}
        return render(request, 'manager/show.html', context)
    
    def search(request):
        search_term = request.GET['show_search']
        search_results = urllib2.urlopen("http://thetvdb.com/3BBD3F7E1043129C/GetSeries.php?seriesname=%s" % search_term)
        return HttpResponse(search_results)
    


Answer: This is your problem:

    
    
    url(r'^manager', include('manager.urls')),
    

should be

    
    
    url(r'^manager/', include('manager.urls')),
    #             ^ The missing /
    

Now, the reason `index` works is, there is a pattern that matches `/manager`

Note that: `manager123/` (#where 123 is the show id) or `managersearch/`

would be valid URLs (non-404) in your application.

