TemplateDoesNotExist at / index.html

18,404

Solution 1

in pythonwhere.com, you need to do this in settings.py

'DIRS': ['/home/your_user_name/your_project/templates'],

Solution 2

Mention your App Name in 'settings.py' in main project folder:

INSTALLED_APPS = [
    'Your_AppName',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]
Share:
18,404
송요섭
Author by

송요섭

Updated on June 26, 2022

Comments

  • 송요섭
    송요섭 almost 2 years

    I have some problem in my Django project.

    I am new to make web application with django. please help me.

    So,

    This is my directory path,

    -lullabyluna
    ----app_index
    ------------admin.py
    ------------index.html
    ------------__init__.py
    ------------migtations
    ------------models.py
    ------------tests.py
    ------------views.py
    ----index.html(I wonder this files path.)
    ----lullabyluna
    ------------__init__.py
    ------------settings.py
    ------------url.py
    ------------wsgi.py
    ----manage.py
    ----static
    

    and my settings.py file include the:

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

    and this is my url.py file

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

    and finally this is my app_index/views.py

    from django.template import RequestContext
    from django.shortcuts import render_to_response
    
    def home(request):
        return render_to_response('index.html',{},context_instance=RequestContext(request))
    

    so, I want to know where is the right "index.html" file's path.