Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
View | Write the First Page
Django: First Dive
course content

Зміст курсу

Django: First Dive

Django: First Dive

1. Get Started
2. Write the First Page
3. Models
4. Working with Database
5. Templates
6. Request Handling

bookView

Now, we will write the Hello, World! page in the Django project.

First, we need to implement the hello_world in our new app. Open the app folder, find the views.py file, and open this file. Look at the file location:

The views.py file structure:

Note

The suggested render function will be described later.

Views should return the HttpResponse object.

Now, let's write the hello_world_view function (view).

First, import the HTTP response object:

HttpResponse object should be imported from django.http module.

The HttpResponse object converts the Python string to HTML:

To make our view work with a request, it needs to be connected to a specific URL. Let's see how to do this in the next chapter.

What should views return?

What should views return?

Виберіть правильну відповідь

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 1
We're sorry to hear that something went wrong. What happened?
some-alt