Monday, February 7, 2022

Re: web page blank

it  is now, thank you for your help!

On Wed, Feb 2, 2022 at 12:23 AM Dev femibadmus <devfemibadmus@gmail.com> wrote:
Is it working fine for you?


If not url blog/home.html?

On Wed, Feb 2, 2022, 08:08 Sebastian Jung <sebastian.jung2@gmail.com> wrote:
Hello,

Please try:

context = {
        'posts': post
    }

'Delvin Alexander' via Django users <django-users@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+unsubscribe@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.

--
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+unsubscribe@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.

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/OKU-v7eWPtc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAD9bWYzcLeS5HbKQvpa3v%3Drt015_Pufd8BVMe7R_U0OaGZO09g%40mail.gmail.com.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADq-sidAHHy6V0%3DqXdOz%2BRDVfnB5cBragq%3DJ59Cd4R2yTk6xdQ%40mail.gmail.com.

No comments:

Post a Comment