Python Django Tutorial – Full Beginner Guide Website Design

Python Django Project (Basic Homepage):

Requirements(Before Start Project):

  • Install Latest Version Python from https://python.org & Install.
  • While you will install the Python, Then Click on “Add To Path” option
  • Once Installation Would be complete then Open CMD and Type “python” to check It’s install properly or not.
  • Now Open CMD Terminal and install Django : type: “pip install django
  • Once Django would be install check it using “django-admin” in CMD Terminal.

Now to Start Project Open Your Command Terminal and Select Folder where you want to create or start your project e.g: C:\user>cd desktop

Now To Start Project Type in CMD “django-admin startproject appname” e.g:

C:\user\desktop> django-admin startproject basic

Now, It will create a new folder inside your desktop with named “basic”. Let’s Begin our development section. Follow all steps with focus and eager.

Now once your project will be create go inside your project through “cd basic” and type following commands:

C:\user\desktop\basic> python manage.py runserver

After successfully running code, It will give you an url e.g: http://127.0.0.1:8000/. Go To this Website and you will see your landing page.

Now open your project into the PyCharm IDE Code Editor and follow all instructions. Now once you open your PyCharm then you don’t need to use Windows terminal seperately. Because PyCharm has inbuilt Terminal inside the editor. So, open You PyCharm editor and open project that you been created recently. Now run the server using python manage.py runserver in a terminal and use other terminal for other kind of functions.

When you will open your project into your PyCharm Code Editor then there will be different kind of files available in that project like:

  • manage.py: It used to manage servers, users and networks kind of stuffs. You don’t have to make any changes inside this file.
  • db.sqlite3: It’s a light weight database basically used to store light weight data. In the future, When you would work on big project then you have to use big databases like MySQL etc.

Now, There will be a folder with same name as project name basic, Inside this folder there will a different kind of files e.g:

  • asgi.py and wsgi.py: These files comes in use when you want to deploy your website on server, Usually in the end.
  • settings.py : It’s one of the useful file that we’re going to explore throughout this guide tutorial. In this file you can define Html, CSS path or new apps that you will add etc. Some Important field in this file:
    • ALLOWED_HOSTS = [] , (Here, You will define your domain name)
    • INSTALLED_APPS = […….] , (Here, you need to add app when you create inside your project)
    • TEMPLATES = [….], (Used to define path of Templates)
    • STATIC_URL = [….], (used to add external css, etc)
  • Urls.py : It’s main Url configuration file, that used to set and delete Urls Path of your new app.

Now, above files are the main root app inside the main Project. which will be used to define and changes settings, url etc. So, now you have to create new apps inside your project. In which You will define functionality and coding kind of stuffs.

So We want to develop password generator web app. Therefore, We just need only one app here inside our project. Let’s create:

C:\user\desktop\basic> python manage.py startapp firstapp

Now once you execute above code inside your project then It will create entire folder “firstapp” inside main project. Where you will see files e.g: Models.py, admin.py, apps.py, tests.py, views.py

So, Once you would have created your file then you have make changes into settings.py file. Which you have to add app name inside you INSTALLED_APPS Section, e.g:

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'generator',
]

So, Now open your url given by terminal. You will still see same default page of django and that’s not what we want. we actually want to show our custom page instead of any default.

How Urls.py Works ?

So, First of all we have to understand that how Url works. So, that we can create out custom homepage on specific url.

So, Whenever users enter any Url inside your website then first it’s comes to the urls.py of main root folder. After then It checks that where this particular url are pointed to.

So, Now inside your Urls.py make following changes:

  • remove admin url (We don’t need it anymore for this project)
  • first import in urls : from firstapp import views
  • inside urlpatterns = [ path(‘ ‘, views.home), ]

Now Open Your Views.py inside generator app and edit:

add : from django.http import HttpResponse

Here, You have to define a function home that we’ve recently defined under the urls.py

def home(request):
    return HttpResponse('Hello It's First Web APP')

Now When you open your website then you will be see “Hello It’s First Web APP”. But What If we want to show custom Html and CSS webpage then you have to follow below steps

Now First, Create A folder inside your firstapp named templates and then inside that template folder create a new folder called firstapp. Now inside this folder create your html file e.g: firstapp/templates/firstapp/home.html

After then insert following code

def home(request):
    return render(request, 'firstapp/home.html')

It’s all done.

Well this tutorial is just for the beginners. apart from it, there are bunch of stuffs that you need to learn in Python Django Framework especially It’s Framework.

So, I hope you all will like this article. So, Please don’t forget to share this with your programmers friends.

You may also like

Which Programming Language You Should Learn In 2020?

Top Programming Language

Hi, I thought most of you are beginners in this field. If You’re reading this then I thought you have interested to build your career in Software Field Or either you might want to make your own something like apps, software etc. First Of all, You have to figured out that Which Programming Language You should pick and Learn first.

So, Which language you’re going to choose will be totally depend on Whatever Your goal would have. For An Example: If you want to be An android developer then you should go with JAVA Or Kotlin. else If you want to a web-developer then you should go with HTML, CSS, Bootstrap And JavaScript.

But In this Article I’m going share with you guys that which programming language you should learn in 2020. This list totally based upon demand of programming Language in Market.

Programming Languages To Learn in 2020:

1. Python:

Python is one of the best and most recommendable Programming language from me as well as from market. If you’re new in Programming Language and looking for What Programming Language should I First? Then My Answer will be the Python. According To Google Trends, Currently Python is most demanded language in the world. There are different kind of fields, In which you enter through the Python Language.

Which Programming Language You Should Learn in 20202

It’s an Object Oriented, High Level and Interpreted language, Which is used in varieties of fields e.g. Web Development, AI, Machine Learning, Data Scientist, Software Development etc. I would like to share that Instagram and Dropbox has built over the Python.

There are different kind of things that you can do with python, because, Python has come with strong modules and packages. These package and modules takes your efficiency up to the next level. I would like to recommend it to all beginners because of It’s easy syntax.

Python Developer(Avg Salary): Rs. 4,98,000- Rs. 8,00,000/ Annum

You May Also Like: Why You should Choose Python As First Programming Language?

2. JAVA

There is no doubt to say that Java will be still in exist in upcoming decades. Because It’s one of the old, trusted and widely used language mostly in big enterprises. Java is used by lots of big companies and will be remain in demands for further decades. So, I think It will be the best option to learn this language. Because there is huge demand of java developers in the markets especially in Enterprises. Because Java is most preferable language to develop enterprise application.

Java is an Object Oriented, high level programming language, which has lots of Object oriented features like Classes, Packages, Interface etc. That would be help you out to make powerful software.

Java Developer(Avg. Salary): Rs. 400,000 – Rs 7,00,000 / Annum

3. JavaScript:

Here, It is stand out at 3rd no. in our List. JavaScript is a high-level, Dynamic programming language that is basically used to give a dynamic and functionality features into your website. Mostly, It’s used along with HTML, CSS to give some functionality into your website. However, There are also different kinds of field, Where you can use JavaScript e.g. Web Development, Web Servers, Games Etc.

JavaScript Developer(Avg Salary): Rs. 6,80,000

4. Flutter

It’s not a Programming Language. Basically, It’s a Software Development Kit (SDK), Which comes in used to develop Cross platform Application For Android and IOS. In simple word, It allows developers to develop an Application by using Dart Programming Language. The applications that have developed under the Flutter Framework will run on Both OS e.g Android, IOS. You don’t have to write code separately for each platforms. This SDK has been developed by Google and the demands of Flutter Developers have been increasing continuously.

Flutter Developer(Avg. Salary): Rs. 2,76,000 – 6,00,000

5. C#

C# is one of the most popular programming language developed by Microsoft that run on .Net Framework. This Language is basically used to develop highly secured web application, mobile apps and Games too. If you’re Interested in any of these fields then this language would be the best for you.

These were the best Programming language that you should learn in 2020, not all at one time. But you should learn atleast one the above.

Learning the Programming language isn’t the last thing that would land you to your dream Job. Besides from these, You must have to learn Frameworks along with these Programming languages e.g: Python with Django, Java with Spring, C# with .NET or Unity, JavaScript with Angular and so on.

Important Note

So, That’s it for today, I hope you all would like this article about “Which Programming Language You should Learn in 2020”. If yes, then please don’t forget to share this article with your friends and relatives. You can also follow us on social media platform. If you want to get such kind of article then you can also subscribe our Blog.

Thank’s To Read…

You may also like

Python – The Best Programming Language For Beginner in 2020, Why?

Python

What is Python?

Python is basically a High-Level, Interpreted, General-Purpose, Object Oriented Language that is used in almost every kind of field. According to Stats, Python has been gaining high popularity as compare any other programming language. There are lots of popular website that uses Python as their main language e.g. Instagram, DropBox, Spotify, NetFlix Etc. In AI And Machine Learning, Python has been used as a Core Language. Currently, Python Language is being used by Lots of Startup’s and Companies.

Download More Android Games: Click Here

Why Python?

The main question that would be comes in your mind that Why I should Choose this as My First Programming Language.

Python is the Best Programming Languages For Beginners
Python – Most Popular Programming Language in 2020

Therefore, In this Article, I’m going to give You 3 Main reasons that Why It would be the Best Language for you As a Beginner.

1. Easy Syntax

Python has an Easy Syntax as compare any other programming languages out there, which means you don’t have to write complex codes to print something simple. This Features makes this language easier and understandable. If you want to print something then you will be write your code in Syntax, which is much easier like writing English Sentence.

For An Example: Let’s Assume, You Want to Print “Hello World” on the Terminal by writing fewer lines of codes. Let’s see How You can print “Hello World” by different types of Programming Language…

1. JavaScript:

2. JAVA:

3. C#

4. PYTHON

So, You can see above that How much simple it’s to write Hello World in Python as compare to other languages. Here, You don’t need to remember any kind of ; in your program.

2. Cross Platform And Simplicity:

Python is a cross platform language, Which means once you write you code in One Operating System e.g Windows, then You can also run same program on different platforms like MacOS, Linux Etc.

As compare other programming language like C, Java Etc. Here, You don’t need to worry about memory management e.g. Here, You don’t need to define integers, strings or other datatypes before using them. Python do this task by itself.

3. Huge Community Support:

What It means?, As a Beginner, Initially, You would face some problems and Errors while programming. In such case, It’s huge Community Support would be help you to fix that Error. Because Whatever kind of error you would get that was already countered and solved by someone else. Because Python is one of the oldest programming language out there.

Let me introduce you that what can you Actually Do with Python, So, that you can take the decision that It would be better for You Or Not.

There are various kind of Job in which you can Entered through Python Language e.g. Artificial Intelligence, Web Development, Machine Learning, Data Analyst, Etc.

Why Python?

Let’s explore that What you can do with Your Python Language, Where and What You can build with this Python Language.

Python has thousands of modules and Packages that makes it efficient as compare any other languages. There are some fields and area, where you can use this Python Language.

1. Web Development

Yes Obviously, You can develop dynamic and secured website by using Python. There are two most popular Frameworks that comes in use while you will develop website with this language. These frameworks are Django and Flask, Both of them are written in Python Language. You can build most beautiful and powerful website with help of Python.

Do you Know: Instagram has developed by using Python Language. There are also different types of popular website that uses Python as their Core Language e.g. DropBox, NetFlix, Spotify.

2. Data Mining:

Data Mining is a basically a Web Scrapping, In which you can extract useful and important data from other website. There is a Python’s module called BeautifulSoup, Which you to extract data from website and you can store them into an Excel, Etc file.

3. Automation:

Doing same thing again and again, Isn’t it Boring task?, Here, You can automate those task that you uses on regular basis by using Python. You just need write down fewer lines of Script and then It’s Boom. Now, you It will do all the tasks as per your instruction.

Example: Let’s Assume, You want to order something from Swiggy.com. But you don’t want to waste your time to explore and find food from best restaurant and at cheap price. In such case you can automate things by using this Language. After writing few lines of codes, You can automate things. After then Your Program will automatically find out all those best rated Restaurant list who provides foods at cheaper price.

4. AI And Machine Learning:

This is one of the more and core field of Python. AI is our Future, Have you watched Iron Man Movie?. If yes then You must have heard about Jarvis AI. An AI assistant who find out and reply the best answer to you.

In real world, you can take example of Google Assistant and Alexa. You can build an AI by using Python and You can also use it in Machine Learning.

There are different kinds of module available in this Language that help to build an AI e.g. PyTorch, Pandas, Scikit-learn Etc. If you would tell me to describe this field in One Word, My answer will be “FUTURE“.

Apart From it, There are also different kind of fields like Game Development, Data Analysis, Ethical Hacking Etc.

It is best for those who wants to build their imagination into the reality.

I think above explanation would be enough to make decision that “Why Should I Choose Python As My First Programming Language?”.

I hope you would like this article. If yes, then please don’t forget to share this article with your friend and geeks. Because It’s encourage me to write more and more article like this. You can also follow us on social media platforms.

Thank’s For Reading…

You may also like

Aarogya Setu App Launched By Indian Govt. To Fight Against Covid-19 (Review)

In Tuesday Morning, when India’s Prime Minister was addressing to the nation then he urged all the countrymen to download the “Aarogya Setu App“. Which has been designed and developed by Ministry Of Human Resources Development.

In today’s Article, I’m going to give you full deep analysis of this application, which means How It’s actually works. As I told you that this application is launched by Ministry Of HRD associated with Digital India Initiative. The Main purpose to launch this app was to help control the spread of Coronavirus Pandemic.

Install Aarogya Setu App: PlayStore Link(Click Here)

How Aarogya Setu App Works?

Since It’s launch, This app has been downloaded by more than 10 Million+ Indian User on both Android and IOS. This Aarogya Setu App actually helps to provide information to all user who has been using it.

After Downloading, When you first open this application, then It asks some question to you like You Have a Cough? Or You’re Facing any Difficulty in breathing etc. If you don’t have such kind of problems, then you will be in Green Zone.

This application actually tells you to keep your Bluetooth and Locations on. Whenever the user visits new crowded area then Arogya setu App keeps sending message from nearby Person mobiles through Bluetooth. So, Whenever users will be at near someone who is also a normal then It’s shows Green Zone. But In case If that person becomes corona positive after 10 Days, then It will alert you soon. So, that Moment You can get yourself checked.

Get App Cloner To Clone Apps: Click Here

This Aarogya Setu app also tells you about the hotspots available around you. According to the Ministry Official that this apps uses Bluetooth, Location Technologies along with Algorithms and Artificial Intelligence that makes calculation on the basis of User Interactions.

Currently, This application has available in 11 Different language, So that you can choose the language which you familiar with. This App has an ability to manage huge workload.

So, this is all about this application. As would you know that this Virus has been spreading rapidly. So, that If you want to protect your family and friends then please Stay at Home. Remember Don’t forget to install this Aarogya setu app in your device.

You can also share this article with your friends and family.

You may also like