template not exist error snap in attechment

23 visualizações
Ir para a primeira mensagem não lida

tribhuvan kishor

não lida,
11/01/2019, 06:13:3411/01/19
para django...@googlegroups.com
URL
 path('<int:year>/<slug:post>/',views.post_detail, name='post_detail'),
VIEW
def post_detail(request, year,  post):
post = get_object_or_404(Post, slug=post,
status='published',
publish__year=year,)
     return render(request,
'blog/post/detail.html',
{'post': post})

TEMPLATE
{% extends "blog/base.html" %}
{% block title %}{{ post.title }}{% endblock %}{% block content %}
<h1>{{ post.title }}</h1>
<p class="date">
Published {{ post.publish }} by {{ post.author }}
</p>
{{ post.body|linebreaks }}
{% endblock %}
Canonical URL

def get_absolute_url(self):
return reverse('blog:post_detail', args=[self.publish.year, self.slug]

TEMplate DIrectory 
PROJECT/APP/template/blog/detail.html
--
regards 
Tribhuvan Kishor Bhaskar
Screenshot from 2019-01-11 16-42-08.png

NAveeN Kumar Reddy

não lida,
11/01/2019, 07:16:5311/01/19
para django...@googlegroups.com
Check the link before pattern in path function

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACiphSX2LQ-oL0OwktHhLqCFwqqPwVwFagCaGX2rNTiBdxOa%2BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

shiva kumar

não lida,
11/01/2019, 07:53:4711/01/19
para django...@googlegroups.com
Can you put your project file structure. 

Martin K

não lida,
11/01/2019, 10:49:2811/01/19
para Django users
TEMplate DIrectory 
PROJECT/APP/template/blog/detail.html


You see directly in the error that template should be located in  PROJECT/APP/template/blog/post/detail.html

tribhuvan kishor

não lida,
12/01/2019, 00:46:1412/01/19
para django...@googlegroups.com
this is my directory structure

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

For more options, visit https://groups.google.com/d/optout.
Screenshot from 2019-01-12 11-14-25.png

shiva kumar

não lida,
12/01/2019, 01:03:2012/01/19
para django...@googlegroups.com
once post your setting.py file content . i will try to figure it out.


tribhuvan kishor

não lida,
12/01/2019, 02:11:4612/01/19
para django...@googlegroups.com
"""
Django settings for mysite project.

Generated by 'django-admin startproject' using Django 2.0.5.

For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'po3(*jzn*8yzi$765qqcke+ewdc()g6xbwvx(g64i^bw28ulc@'

# SECURITY WARNING: don't run with debug turned on in production!
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',
'blog',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'mysite.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'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',
],
},
},
]

WSGI_APPLICATION = 'mysite.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases

DATABASES = {
'default': {
'NAME': 'mysite',
'ENGINE': 'django.db.backends.mysql',
'HOST': 'localhost',
'PORT':'3306',
'USER': 'root',
'PASSWORD': 'root',
}
}


# Password validation
# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/2.0/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.0/howto/static-files/

STATIC_URL = '/static/'


For more options, visit https://groups.google.com/d/optout.

tribhuvan kishor

não lida,
12/01/2019, 02:12:5912/01/19
para django...@googlegroups.com
even list.html is in the same place and its accessible . i am not getting why showing problem with details.html

shiva kumar

não lida,
12/01/2019, 03:02:3512/01/19
para django...@googlegroups.com
It's not detail it's details.html

tribhuvan kishor

não lida,
12/01/2019, 03:45:2312/01/19
para django...@googlegroups.com
thanks, Shiva I think its matter of lack of concentration from my side thanks buddy, 


For more options, visit https://groups.google.com/d/optout.

tribhuvan kishor

não lida,
14/01/2019, 13:03:1314/01/19
para django...@googlegroups.com
thanks shiva . thanks alot i think a lack of concentration 

On Sat, Jan 12, 2019 at 1:32 PM shiva kumar <kannamshi...@gmail.com> wrote:

For more options, visit https://groups.google.com/d/optout.
Responder a todos
Responder ao autor
Reencaminhar
0 mensagens novas