06 – STOCK MANAGEMENT SYSTEM – SETTING UP VIEWS, PATH/URL AND TEMPLATES FOR THE APPLICATION FRONTEND

Spread the love

1. Create a templates folder in stockmgmgt app where all HTML pages will be saved.

2. Create a home.html in the templates folder and add some text you want to display

3. In views.py is where you define what will be displayed when a user navigates to a URL.

def home(request):
	title = 'Welcome: This is the Home Page'
	context = {
	"title": title,
	}
	return render(request, "home.html",context)

4. Add a path / url for home page

from stockmgmgt import views

urlpatterns = [
        ---
	path('', views.home, name='home'),
        ---

5. Now go to localhost:8000 to view your beautify work


Spread the love

About the author

arbadjie

Hi, I'm Abdourahman Badjie, an aspiring developer with obsession for anything coding and networking. This blog is dedicated to helping people learn to develop web applications using django framework.

View all posts

Leave a Reply

Your email address will not be published. Required fields are marked *