How Django Framework works?

For a newbie, understanding the working of Django framework and importance of each file in the application is quite difficult. When making an application one need to have following things:

  • Django & MySQL installed.
  • Apache configured with application.
  • Basic knowledge and understanding of Python.

When building a module in an application one should have understanding on functioning in each file is dependent on other. When we create an application, the files created are :

In addition to these files, we can add other files too according to the need. The functioning of each file can be explained through the example given below :
When we want to add a module to our application, the first thing we would like to see is menu option which is visible to us, which is linked through a url. Like here I am going to add a client register to my application. So, for that we need have a menu option named ‘client register’.

client register

This can be done by adding the following code in your index.html file or any other template where you want menu option :

<li><a href=”/automation/tcc/clientregister”>Client Register</a></li>

As we have linked the option with some url address thus we need to define this url in Here comes the role of file. The code in urls file goes as follows :

urls file

Here ‘r’ means regular expression that matches the url and then points it to some function defined in file (e.g., When the url on the browser matches with the regular expression that is red circled, it will then call the function ‘client_register’ ¬†defined in file. Thus, now we need to define a function ‘client_register’ in file(in my case) or file.

The code for file goes as follows :

function in


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s