python - Haystack-Django TemplateDoesNotExist at /search/ Error -


i trying integrate haystack django app

here dir structure :

vaibhav@ubuntu:~/temp/haystackdemo/demoapp/templates/search$ pwd /home/vaibhav/temp/haystackdemo/demoapp/templates/search vaibhav@ubuntu:~/temp/haystackdemo/demoapp/templates/search$ ls indexes  search.html  

and getting error : templatedoesnotexist @ /search/

and django debug info :

template-loader postmortem  django tried loading these templates, in order: using loader django.template.loaders.filesystem.loader: using loader django.template.loaders.app_directories.loader: /usr/local/lib/python2.7/dist-packages/django/contrib/auth/templates/search/search.html (file not exist) /usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/search/search.html (file not exist) /usr/local/lib/python2.7/dist-packages/haystack/templates/search/search.html (file not exist) /home/vaibhav/temp/haystackdemo/demoapp/templates/search/search.html (file not exist) 

i did not understand why getting error... have done wrong...

settings.py :

# django settings haystackdemo project.  debug = true template_debug = debug  admins = (     # ('your name', 'your_email@example.com'), )  managers = admins  databases = {     'default': {         'engine': 'django.db.backends.sqlite3', # add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.         'name': '/home/vaibhav/temp/haystackdemo/sqlite.db',                      # or path database file if using sqlite3.         'user': '',                      # not used sqlite3.         'password': '',                  # not used sqlite3.         'host': 'localhost',                      # set empty string localhost. not used sqlite3.         'port': '',                      # set empty string default. not used sqlite3.     } }  # hosts/domain names valid site; required if debug false # see https://docs.djangoproject.com/en/1.4/ref/settings/#allowed-hosts allowed_hosts = []  # local time zone installation. choices can found here: # http://en.wikipedia.org/wiki/list_of_tz_zones_by_name # although not choices may available on operating systems. # in windows environment must set system time zone. time_zone = 'america/chicago'  # language code installation. choices can found here: # http://www.i18nguy.com/unicode/language-identifiers.html language_code = 'en-us'  site_id = 1  # if set false, django make optimizations not # load internationalization machinery. use_i18n = true  # if set false, django not format dates, numbers , # calendars according current locale. use_l10n = true  # if set false, django not use timezone-aware datetimes. use_tz = true  # absolute filesystem path directory hold user-uploaded files. # example: "/home/media/media.lawrence.com/media/" media_root = ''  # url handles media served media_root. make sure use # trailing slash. # examples: "http://media.lawrence.com/media/", "http://example.com/media/" media_url = ''  # absolute path directory static files should collected to. # don't put in directory yourself; store static files # in apps' "static/" subdirectories , in staticfiles_dirs. # example: "/home/media/media.lawrence.com/static/" static_root = ''  # url prefix static files. # example: "http://media.lawrence.com/static/" static_url = '/static/'  # additional locations of static files staticfiles_dirs = (     # put strings here, "/home/html/static" or "c:/www/django/static".     # use forward slashes, on windows.     # don't forget use absolute paths, not relative paths. )  # list of finder classes know how find static files in # various locations. staticfiles_finders = (     'django.contrib.staticfiles.finders.filesystemfinder',     'django.contrib.staticfiles.finders.appdirectoriesfinder', #    'django.contrib.staticfiles.finders.defaultstoragefinder', )  # make unique, , don't share anybody. secret_key = '=7*wk@+p^*)zghrt)+021wh%uj&si+f^8yw%j6+2yo%1)w^vy7'  # list of callables know how import templates various sources. template_loaders = (     'django.template.loaders.filesystem.loader',     'django.template.loaders.app_directories.loader', #     'django.template.loaders.eggs.loader', )  middleware_classes = (     'django.middleware.common.commonmiddleware',     'django.contrib.sessions.middleware.sessionmiddleware',     'django.middleware.csrf.csrfviewmiddleware',     'django.contrib.auth.middleware.authenticationmiddleware',     'django.contrib.messages.middleware.messagemiddleware',     # uncomment next line simple clickjacking protection:     # 'django.middleware.clickjacking.xframeoptionsmiddleware', )  root_urlconf = 'haystackdemo.urls'  # python dotted path wsgi application used django's runserver. wsgi_application = 'haystackdemo.wsgi.application'  template_dirs = (                  '/home/vaibhav/temp/haystackdemo/demoapp/templates'             # put strings here, "/home/html/django_templates" or "c:/www/django/templates".     # use forward slashes, on windows.     # don't forget use absolute paths, not relative paths. )  installed_apps = (     'django.contrib.auth',     'django.contrib.contenttypes',     'django.contrib.sessions',     'django.contrib.sites',     'django.contrib.messages',     'django.contrib.staticfiles',     'django.contrib.admin',     'haystack',     'demoapp' )   haystack_connections = {     'default': {         'engine': 'haystack.backends.elasticsearch_backend.elasticsearchsearchengine',         'url': 'http://127.0.0.1:9200/',         'index_name': 'haystack',     }, }  # sample logging configuration. tangible logging # performed configuration send email # site admins on every http 500 error when debug=false. # see http://docs.djangoproject.com/en/dev/topics/logging # more details on how customize logging configuration. logging = {     'version': 1,     'disable_existing_loggers': false,     'filters': {         'require_debug_false': {             '()': 'django.utils.log.requiredebugfalse'         }     },     'handlers': {         'mail_admins': {             'level': 'error',             'filters': ['require_debug_false'],             'class': 'django.utils.log.adminemailhandler'         }     },     'loggers': {         'django.request': {             'handlers': ['mail_admins'],             'level': 'error',             'propagate': true,         },     } } 

urls.py :

from django.contrib import admin django.conf.urls import patterns, include, url  #------------------------------------------------------------------------------  admin.autodiscover()  urlpatterns = patterns('',      # url(r'^$', 'haystackdemo.views.home', name='home'),     # url(r'^haystackdemo/', include('haystackdemo.foo.urls')),     url(r'^admin/', include(admin.site.urls)),     url(r'^search/', include('haystack.urls')) ) 

it possible problem on file search.html. change this:

{% extends 'base.html' %} 

by this:

{% extends 'myapp/base.html' %} 

see solution bottom of page: https://github.com/django-haystack/django-haystack/issues/1205


Comments