DEV Community

Cover image for First Django App For Beginners Part 3(templates & static files)
Abdul Azeez
Abdul Azeez

Posted on • Updated on

First Django App For Beginners Part 3(templates & static files)

For this part of tutorial we are going to be building A simple Django Booking(appointment) App!

Welcome Back!

Let's get started.
  • Start by creating a project called appointment
  • Also create a app called app
  • Register your app in your project folder
  • And do your url config.
Pls Get the template folder we are going to be using fromLink to my Github Profile

Let's Get Started!

Template and Static files Settings.

Step 1: after setting up your django application we will register our template files

Template Settings

Step 2: Static Files

Static Settings

Urls and Views

I hope you have already set up your urls if you haven't set it up to see if you can do it if you encounter any error pls comment in the comment section!

Let's get started!


What is is a file that allows us to completely define our database!


What is context in our
So we imported our models in line 2 of our code and we want to show something from our database so we use context manager to help us render models to view!


What did we do in
We imported our views file and used it to create our url


What just happened in the file:
we imported our model and register it so it can be viewed in the admin site

*Introduction to Django Admin Site *
What is Django admin?
Django Has a built-in admin site that handles the site management and to log in to the admin site we need to create a superuser to do that we use this command python createsuperuser it will throw an error because you haven't make your migrations
to do that we use this command python makemigrations the command will initialize your database and then this command python migrateto create the necessary tables and columns then you can crate your super user

now crate your superuser and runserver then go to /admin

you will discover a page saying login so you enter your superuser credentials and boom a dashboard

django admin site

Add some models and play around with it
Pls Comment if you encounter any errors

Catch Ya Later!

Play Around With this Part 4 will contain user authentication and sending mails i hope we all have a great understanding of django

Top comments (0)