Learning Django terms and starting overviews

1.) __init__.py: This is used to mark directories in python as python package directory. To understand this, please look at the image below which is used in this live project and understand what I mean to say.

Use of __init__.py

Use of __init__.py

Now if you want to use views.py in urls.py using __init__.py, you may call this in urls.py as from patients_app import view.py.

2.) settings.py: Many features can be viewed in settings.py such as secret key, allowed host, debugging and installed app. If programmer has created an application inside the current folder, it needs to be included in settings.py under the section installed app. Please look at the down image and know this step more. See I have included Medical_app at the end.

Installed Apps

Installed Apps

It also contains a section MIDDLEWARE_CLASSES which is used for handling client server request and response. You can work with database by configuring it here. Such option is also available here. Please look at the image to understand my point of view.

Database configuration with Django

Database configuration with Django

3.) urls.py: This is very important file and is used for mapping between views.py and urls.py. To make you understand, let us write a simple code in views.py

from django.http import HttpResponse
def aisangam(request):
   text = “Please visit AI Sangam for AI and excellence in Machine learning along with        web integration”
   return HttpResponse(text)
Look at the parameter request we need to supply the request so that particular response is hit. This request is provided by urls.py.
from django.conf.urls import patterns, include, url
from django.contrib import admin
from url.views import hello
urlpatterns = [
    # url(r'^admin/', admin.site.urls),
    url(r'^aisangam/$', aisangam),

If you go to This is the local address of your computer which is based on apache2 server.

4.) manage.py: It performs the same thing as done by django-admin. It sets Django-setting-module environment variable to your project setting file.

One thought on “Learning Django terms and starting overviews”

  1. James Mank says:

    I believe it is an outstanding blog site, I have actually been browsing all over the web to discover something which helps memake my jobs easy. Many thanks for sharing!

Leave a Reply

Your email address will not be published.