[PYTHON] [Learning memo] How to make an application with Django ~ Until Hello World is displayed ~

Qita Continued

Make an app

$ python manage.py  startapp picblog

Add app to INSTALED_APPS in settings.py


INSTALED_APPS =[
    'picblog.apps.PicblogConfig',
]

Create html

Create a template folder in picblog and create a new folder called picblog in it. Write html here.

Create base.html and home.html in the created template / picblog folder.

Write the characters you want to represent in home.html

hello world

Set views.py

from django.views.generic import TemplateView

class Home(TemplateView):
    template_name='picblog/home.html'

Connect url

Open config urls.py

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('',include('picblog.urls')),
    path('admin/', admin.site.urls),
]

Create urls.py in picblog app

Home is the class name written in views.py


from django.urls import path
from . import views

app_name='picblog'

urlpatterns=[
    path('',views.Home.as_view(),name='home'),
]

Run server

$python manage.py runserver

OK if hello world appears on the updated web page

Recommended Posts

[Learning memo] How to make an application with Django ~ Until Hello World is displayed ~
[Learning memo] How to make an application with Django ~ From virtual environment to pushing to github ~
Create a one-file hello world application with django
How to make an HTTPS server with Go / Gin
I tried to make an OCR application with PySimpleGUI
Beginners try to make an online battle Othello web application with Django + React + Bootstrap (1)
Until hello world with zappa
How to convert an array to a dictionary with Python [Application]
How to authenticate with Django Part 2
How to authenticate with Django Part 3
How to make an artificial intelligence LINE bot with Flask + LINE Messaging API
How to build an application from the cloud using the Django web framework
How to do arithmetic with Django template
How to build Hello, World on #Nix
How to display Hello world in python
Let's make an A to B conversion web application with Flask! From scratch ...
How to make an embedded Linux device driver (11)
How to make an embedded Linux device driver (8)
How to make an embedded Linux device driver (4)
How to develop a cart app with Django
How to make a dictionary with a hierarchical structure.
How to make an embedded Linux device driver (2)
How to crop an image with Python + OpenCV
Say hello to the world with Python with IntelliJ
How to make an embedded Linux device driver (3)
How to read an array with Python's ConfigParser
How to implement "named_scope" of RubyOnRails with Django
Explaining how to make LINE BOT in the world's easiest way (2) [Preparing a bot application in a local environment with Django in Python]
[Blender x Python] How to make an animation
How to make an embedded Linux device driver (6)
How to make an embedded Linux device driver (5)
How to make an embedded Linux device driver (10)
To myself as a Django beginner (3)-Hello world! ---
How to make Linux compatible with Japanese keyboard
How to make an embedded Linux device driver (9)
How to make an arbitrary DictCursor with PyMySQL and not return None when NULL
Django Learning Memo
Procedure for creating an application with Django with Pycharm ~ Preparation ~
How to deploy a Django application on Alibaba Cloud
How to make a shooting game with toio (Part 1)
Reinforcement learning 37 Make an automatic start with Atari's wrapper
How to make an interactive CLI tool in Golang
How to deploy a Go application to an ECS instance
Single sign-on to your Django application with AWS SSO
How to make an embedded Linux device driver (12) (Complete)
A memo about building a Django (Python) application with Docker
How to use Decorator in Django and how to make it
Scraping with Python-Selenium is old! ?? ・ ・ ・ How to use Pyppeteer
How to operate Firefox with selenium on Windows Memo
Make an application using tkinter an executable file with cx_freeze
[Python] I tried to make an application that calculates salary according to working hours with tkinter