How to create "Hello word" app?
Here we will create hello world app, it is a simple app which help to learn basic structure and flow of project. By using this app we go through all files.
Structure of hello word app

Workflow with coding
In this we will do complete coding part step by step.
First open setting.py file which located at HelloWordApp project folder, add app name at last of INSTALLED_APPS part.
setting.py:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'helloworld'
]
In above code bold part is appname. Now we go to the view.py which exist at project app folder helloworld.
view.py:
#from django.shortcuts import render
from django.http import HttpResponse
def Hello(request):
return HttpResponse("Hello")
Now go to the urls.py and set urls path.
urls.py:
from django.contrib import admin
from django.urls import path
#from helloworld.views import Index
from helloworld.views import Hello
urlpatterns = [
path('admin/', admin.site.urls),
#path('helloworld/',Index),
path('helloworld/',Hello)
]
After this you can run from terminal or cmd by using running command:
>python manage.py runserver
And you will find url like this and open it on browsers and run.
Django version 2.2.1, using settings 'HelloWordApp.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Not Found: /
Now you find output window after running this url with app name as a path like
http://127.0.0.1:8000/helloworld
Output:
