How to Create, Install & Deploy Your First Django App


In this tutorial, we will be creating, installing and deploying our first Django app. We will also learn to add the app in urls.py file and create the views.py file for the Django project. This tutorial will also let you grasp the concept of web application more easily.

Firstly, let’s discuss the process of creating a Django app.

1. How to Create a Django App

The main reason we are using web applications in the first place is to implement Django’s code reusability feature.

This enables us to not only migrate the pre-built apps in our project but also customize web applications made by us.

All the commands are given in our root directory or in the directory where we have the manage.py file.

Open the terminal and type the below command to create a new project:

             django-admin startproject project-name

Now, type below command to create a new application under the project directory

            django-admin startapp application-name

Here I gave my application-name as 'mydjango'. After entering the command, goto the new project directory (in my case mydjango).


2. Running the Test Server

For testing the project, change your directory to the Django project directory and there you must see the manage.py file. It is because that is the control file which we will use to operate our project, every time and it’s very important.

Type this command to check the project in the browser:

                 python manage.py runserver

This command execution should look like this.


Now, you can run the server application, just go to your browser and type this in the url bar:


This is the test server page on the web browser, of course, we are doing the backend and we haven’t done any real work yet. We have just created a Django project and learned the process to run the server so that we will be able to deploy our project.









Comments

Popular posts from this blog

Create Desktop Application with PHP

Insert pandas dataframe into Mongodb

Python desktop application