part-1

Setting Up Django Project

This chapter will teach you the following:

  • Installing Django.
  • Setting Up our project

Let’s start off by installing the the required packages for our Blogging App.You can do this in virtual environment ,I am mainly focusing on Django so if you want to learn to work with virtual environments or installing python you can read my other posts.

So let’s install Django 3.x in our virtual Environment or in terminal if you are using PyCharm,( if you are installing django 3.x then make your python version is 3.8 or above because although django 3 supports python 3.6 and 3.7 most of the functionalities we need might not work well),and to do so write this in your command line

And also if you wanna check your version of django ,then run this

And now to create our django project directory run this command

the ‘blog_project’ is the name of our project and you can change it to your custom project name.

Note:To list out all the subcommands of django-admin which we will see later run this command

The startproject <projectname> will create a new directory with projectname in your specified path.So cd into your project directory,for me it’s

And now open your text editor in the project directory.If you dir in the project directory you’ll find another blog_project directory and mange.py file like this

And now back to our terminal, in our blog_project directory where the mange.py file is run this command

Follow the link http://127.0.0.1:8000/ and you’ll see a landing page thst says installed worked successfully

Now that we have our project we can create multiple apps in our project.Like we can have a posts app and then we can another app which will do the payments and etc..

To understand the difference between django project and an app refer this page

So now, in the same directory where we have our mange.py file we will an app with the following code

again, the blogs is the custom app name and you can set your app name to anything you want.The structure will look like this now

There have been a lot of files by now, but you’ll understand what each does by the completion of the course.

Next Up..

Previously..

Posting Django Tutorials with Beginner to Advanced Projects