python - Templates Django (Does not exist at/) -


i'm trying use django templates cant display simple html line don't understand why... searched resolve after many test, problem remains.

this structure:

enter image description here

my urls.py (which work tried fonction in views.py):

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

my views.py:

from django.shortcuts import render django.template import template , context  # create views here. # -*- coding: utf-8 -*-  def home(request):     return render(request, 'mysite/bap2pmonitoring.html') 

my setting file setting.py:

templates = [     {         'backend': 'django.template.backends.django.djangotemplates',         'dirs': [os.path.join(base_dir, 'templates'],         'app_dirs': true,         'options': {             'context_processors': [                 'django.template.context_processors.debug',                 'django.template.context_processors.request',                 'django.contrib.auth.context_processors.auth',                 'django.contrib.messages.context_processors.messages',             ],         },     }, ] 

my simple html doc:

<h1> bap2p monitoring </h1> 

and output main problem :

enter image description here

and traceback:

environment:   request method: request url: http://127.0.0.1:8000/  django version: 1.8.1 python version: 2.7.3 installed applications: ('django.contrib.admin',  'django.contrib.auth',  'django.contrib.contenttypes',  'django.contrib.sessions',  'django.contrib.messages',  'django.contrib.staticfiles') installed middleware: ('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',  'django.middleware.security.securitymiddleware')  template loader error: 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/admin/templates/mysite/bap2pmonitoring.html (file not exist) /usr/local/lib/python2.7/dist-packages/django/contrib/auth/templates/mysite/bap2pmonitoring.html (file not exist)    traceback: file "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response   132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs) file "/home/florian/documents/mysite/polls/views.py" in home   8.    return render(request, 'mysite/bap2pmonitoring.html') file "/usr/local/lib/python2.7/dist-packages/django/shortcuts.py" in render   67.             template_name, context, request=request, using=using) file "/usr/local/lib/python2.7/dist-packages/django/template/loader.py" in render_to_string   98.             template = get_template(template_name, using=using) file "/usr/local/lib/python2.7/dist-packages/django/template/loader.py" in get_template   46.     raise templatedoesnotexist(template_name)  exception type: templatedoesnotexist @ / exception value: mysite/bap2pmonitoring.html 

out of ideas, need opinion please. time

p.s: please edit question instead of adding answer question question :p

coming error,

from directory structure, have 2 template directories, 1 in main project , other in polls app @ mysite/polls/mysite/. django looking templates in project templates i.e.,

/home/florian/documents/mysite/templates/mysite/bap2pmonitoring.html

but have template in

/home/florian/documents/mysite/polls/templates/mysite/bap2pmonitoring.html

put templates in main project template directory , should work.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -