Install and enter the pipenv shell
python3 -m pip install --user pipenv pipenv install django==3.0 pipenv shell
Create a project
django-admin startproject helloworld_project . python3 manage.py migrate python3 manage.py runserver
Start an app
python manage.py startapp pages # Add pages.apps.PagesConfig to helloworld_project/settings.py:INSTALLED_APPS
Add a view to the app
# pages/views.py:
from django.http import HttpResponse
def homePageView(request):
return HttpResponse(‘Hello, World!’)
Add a url to the view in the app
# pages/urls.py: from django.urls import path from .views import homePageView urlpatterns = [path('', homePageView, name='home')]
Add the url’s from the app in to the project url’s
# helloworld_project/urls.py from django.contrib import admin from django.urls import path, include # new urlpatterns = [ path('admin/', admin.site.urls), path('', include('pages.urls')), # new ]
See if it works
python3 manage.py runserver
Close the pipenv shell
exit
To remove the pipenv
pipenv --rm