Thanks

Le mer. 2 févr. 2022 à 13:37, kka kar <kargka01...@gmail.com> a écrit :

> I recreated the project and changed the view function to the below, and it
> now works fine for me:
>
> def home(request):
> context = {
> 'posts': post
> }
> return render(request, 'home.html', context)
>
> On Wednesday, February 2, 2022 at 8:23:46 AM UTC devfem...@gmail.com
> wrote:
>
>> Is it working fine for you?
>>
>>
>> If not url blog/home.html?
>>
>> On Wed, Feb 2, 2022, 08:08 Sebastian Jung <sebasti...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> Please try:
>>>
>>> context = {
>>>         'posts': post
>>>     }
>>>
>>> 'Delvin Alexander' via Django users <django...@googlegroups.com>
>>> schrieb am Mi., 2. Feb. 2022, 06:59:
>>>
>>>> Hello everyone,
>>>>
>>>> I am currently following a django tutorial regarding applications. I
>>>> have followed through completely but for some reason, when I run server, i
>>>> incur no errors but the web page is blank. Why would this be?
>>>>
>>>> Here is what is not displayed:
>>>>
>>>> from my Home.html file:
>>>> <!DOCTYPE html>
>>>> <html>
>>>> <head>
>>>>     <title></title>
>>>> </head>
>>>> <body>
>>>>     {% for post in posts %}
>>>>         <h1>{{ post.title }}</h1>
>>>>         <p>By {{ post.author }} on {{ post.date_posted}}</p>
>>>>         <p>{{ post.content }}</p>
>>>>     {% endfor %}
>>>>
>>>> </body>
>>>> </html>
>>>>
>>>> from my views.py file:
>>>> from django.shortcuts import render
>>>>
>>>> post = [
>>>>     {
>>>>         'author': 'CoreyMS',
>>>>         'title': 'Blog Post',
>>>>         'content': 'First Post Content',
>>>>         'date_posted': 'August 27, 2018'
>>>>     },
>>>>     {
>>>>         'author': 'Jane Doe',
>>>>         'title': 'Blog Post 2',
>>>>         'content': 'Second Post Content',
>>>>         'date_posted': 'August 28, 2018'
>>>>     }
>>>> ]
>>>>
>>>> def home(request):
>>>>     context = {
>>>>         'post': post
>>>>     }
>>>>     return render(request, 'blog/home.html', context)
>>>>
>>>> def about(request):
>>>>     return render(request, 'blog/about.html')
>>>>
>>>> My urls.py:
>>>> from django.urls import path
>>>> from . import views
>>>>
>>>> urlpatterns = [
>>>>     path('', views.home, name='blog-home'),
>>>>     path('about/', views.about, name='blog-about'),
>>>> ]
>>>>
>>>>
>>>> --
>>>> 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/e9b557a6-403b-46ce-bc18-8d19b0091f2an%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/e9b557a6-403b-46ce-bc18-8d19b0091f2an%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> 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/CAKGT9mzFaC4Eq9B_76nb0N2%2BRW-%2BNkbLMdfJT0Vph2qWuGefOw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAKGT9mzFaC4Eq9B_76nb0N2%2BRW-%2BNkbLMdfJT0Vph2qWuGefOw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c2f8ef77-d0ef-4868-8680-0314442952f9n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/c2f8ef77-d0ef-4868-8680-0314442952f9n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKvw4qy5WGaOaSPxZp27nZH-jFZps4nJreNE29w%3DgDaGNAJyPg%40mail.gmail.com.

Reply via email to