How to Create an App in Django 


               


How to Create an App in Django



Python


In this article, we show how to create an app in Django.

By an app, what is really meant is a webpage.

When you think of an app, think of a webpage, because that's what an app really is.

Basically, before you create an app, you must create a project. The project represents the entire website. The app represents a webpage in the website.

So, before you create an app, you must have the website. To see how to create a project (website) in Django, see the following page: How to Start a Project in Django.

So, once you have a project created, the next step is to begin creating apps, or webpages, for your site.

So, this is where we go now.

So, I created a project called mywebsite. This is the name of my website.

So, now open up the command prompt on your computer and type in the full path to your folder of the project that you created (in my example, again, it is mywebsite).

So, once you've specified the full path to the project that you created in Django, the next step is to type in the following command.

In this example, we create the app, Blog, representing a webpage that will function as the blog for the website.



In a Windows PC, many times, the first word, python, will not work. Instead, use py. This is shown below.



This is how this will appear in the command prompt.

Django startapp

So, we've now created the app, Blog, in django.

Now, if you look in your project's directory, you should see this folder present with the name of the app, Blog. In this folder will be several files that are important in order to show the app on a web browser.

There's a few things we must do in order for this app to work and be shown on a web browser. We will discuss this in later tutorials.

Just realize that, for now, the code above creates an app, or web page, in a website powered by Django.


Related Resources

How to Show All Tables of a MySQL Database in Python

How to Count the Number of Rows in a MySQL Table in Python



HTML Comment Box is loading comments...