16
First Django App For Beginners Part1 (setup & installation)
What is Django?
Django is a high-level Python web framework that encourages clean development and fast, with pragmatic design.
Why Django?
Ridiculously fast.
Django was designed to guide developers take projects from intellection to completion as quickly as possible.Reassuringly secure.
Django takes security seriously and helps developers avoid many common security mistakes.Exceedingly scalable.
Some of the busiest sites on the web ascendancy Django’s ability to quickly.
Before You Start make sure you have python installed on your computer.
You must have Python installed on your system if you don't have check out link to python.org
Let's Start!
Step 1: Installation
pip install django
So step 1, will install django on your systemStep 2: To start a project use this command
django-admin startproject mysite
thencd
to wherever the project folder is in and run this command to create a apppython manage.py startapp sites
to create a app
Project Folder Structure:
mysite/
manage.py
mysite/
__init__.py
settings.py
urls.py
asgi.py
wsgi.py
App Forlder Structure:
sites/
__init__.py
admin.py
apps.py
migrations/
__init__.py
models.py
tests.py
views.py
Then run your server with this command: python manage.py runserver
You will see a success page like this:
for you to make changes in your app folder and for it to work you will have to register your app inside your settings.py like this below
Line 34 in your settings.py file
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'your_app_name_here', # your app(s) goes inside this list
]
16