Django blog post not linking to detail.html page

44 views
Skip to first unread message

amanda

unread,
Jan 19, 2020, 11:26:31 AM1/19/20
to Django users
Hello,
I am new to Django, i follow a book : Django by Example 2. i install a blog, it show blog post list, but when i click post title, it does not go to post detail.html page.
anyone can tell me where i can wrong?
Thank you very much!



1.JPG
2.JPG
3.JPG
4.JPG
5.JPG
6.JPG
7.jpg

Gerardo Palazuelos Guerrero

unread,
Jan 19, 2020, 12:45:11 PM1/19/20
to django...@googlegroups.com
Hello,
File: template/blog/post/list.html, line 7
It doesn’t sounds good at least for me.
The way I do is:
<a href=“{% url “here_goes_entry_urls.py_for_detail” post.id %}”>post.title<a/>



---
Gerardo Palazuelos
Enviado desde mi iPhone


El 19 ene 2020, a la(s) 9:25, amanda <amandam...@gmail.com> escribió:


--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2fb56c3c-6eb6-46c9-9162-548a65b3c781%40googlegroups.com.
<1.JPG>
<2.JPG>
<3.JPG>
<4.JPG>
<5.JPG>
<6.JPG>
<7.jpg>

John

unread,
Jan 19, 2020, 5:28:24 PM1/19/20
to django...@googlegroups.com

/mysite/blog/urls.py, line 2 is bad syntax and should probably read:

from .views import *

You should also be seeing some kind of error from your webserver (are you running the site using runserver first?) which would give you a clue where the problem is.

John

amanda

unread,
Jan 20, 2020, 12:43:10 AM1/20/20
to Django users


在 2020年1月19日星期日 UTC+1下午11:28:24,John写道:

/mysite/blog/urls.py, line 2 is bad syntax and should probably read:

from .views import *

You should also be seeing some kind of error from your webserver (are you running the site using runserver first?) which would give you a clue where the problem is.

John

On 19/01/2020 16:03, amanda wrote:
Hello,
I am new to Django, i follow a book : Django by Example 2. i install a blog, it show blog post list, but when i click post title, it does not go to post detail.html page.
anyone can tell me where i can wrong?
Thank you very much!



--
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...@googlegroups.com.

amanda

unread,
Jan 20, 2020, 12:54:20 AM1/20/20
to Django users
Hi John,
Thank you!
I config setting DEBUG = True, but my webserver does not display any error message. i use pythonanywhere host, i do not need running: runserver.
I did try your advise, if i did that, i got error message:

在 2020年1月20日星期一 UTC+1上午6:43:10,amanda写道:
11.JPG

maninder singh Kumar

unread,
Jan 20, 2020, 1:08:17 AM1/20/20
to django...@googlegroups.com
I see you have put href as post.get_absolute_url
You could for instance use a relative path.  Put a page field in your model Post, to refer to the html that the post will be on.
And then :
{% for text in post_list%}
  <a href = "posts/{{text.content_Page}}">  {{text.content_Title}} </a>
    {{text.content_Description}}
    {% endfor %}

This ways you would always be able to keep track of your post pages.
 
Thi
               
 


--
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.

amanda

unread,
Jan 20, 2020, 1:08:18 AM1/20/20
to Django users
Hi Gerardo, 
i am not full understand, your mean is for example

<a href=“{% url “blog/post/detail.html” post.id %}”>post.title<a/> ?  
<a href=“{% url “here_goes_entry_urls.py_for_detail” post.id %}”>post.title<a/>



在 2020年1月19日星期日 UTC+1下午6:45:11,Gerardo Palazuelos写道:
Hello,
File: template/blog/post/list.html, line 7
It doesn’t sounds good at least for me.
The way I do is:
<a href=“{% url “here_goes_entry_urls.py_for_detail” post.id %}”>post.title<a/>



---
Gerardo Palazuelos
Enviado desde mi iPhone


El 19 ene 2020, a la(s) 9:25, amanda <amandam...@gmail.com> escribió:


Hello,
I am new to Django, i follow a book : Django by Example 2. i install a blog, it show blog post list, but when i click post title, it does not go to post detail.html page.
anyone can tell me where i can wrong?
Thank you very much!



--
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...@googlegroups.com.

John

unread,
Jan 20, 2020, 4:06:44 PM1/20/20
to django...@googlegroups.com

OK. I've read further through your code. It looks like it should be:

    from blog import views

But you will have another problem, unless you have defined PostListView somewhere in views.py other than what you have shown (2.JPG in your original email stops at line 35).

I do not have the Django by Example book. Perhaps you should check with that? The error messages tell you which line the error is on.

John

To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/66a517de-64e9-4119-bfe1-0c4da34d9f78%40googlegroups.com.

aakansha jain

unread,
Jan 25, 2020, 1:47:51 PM1/25/20
to Django users
Can anyone tell me how to run the django development environment so that I can contribute to Django

Aditya Khatwa

unread,
Jan 25, 2020, 5:28:36 PM1/25/20
to django...@googlegroups.com
Django 2 by example is pretty good book when it comes to understand django....
If you are having some problems then I suggest you go through the same project in your case blog post again and try to match it with your code syntax most likely you are going to find the problem you are facing. 

--
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.
Reply all
Reply to author
Forward
0 new messages