Django Modularisation

Photo by Jan Huber on Unsplash

Why not to develop all in the main module. Ohhhh? That will be cumbersome when you go for larger scale applications or projects. Modularisation will be easier in django.

First Let’s make the project named django_modules and make and a module django_app (these modules are called as apps in django). Make sure that you have installed django in your machine.

Then you will get following project structure.

Let’s register the application in django_modules/ as follows.

Then you can make django_app/ on the module to isolate its urls and views.

First let’s make a small view in django_app/ .

Then add this view to a url in django_app/ .

The final step is to add your modules url file to the project url file as follows. I have added in django_modules/ .

Then run the application using python runserver and when you go to the it will show “Hi” message.

If you get error running python runserver use python3 runserver .

By modularising you can break your application in to several modules which will help you to understand the code easily and maintain the code easier.

Hopefully this is helpful.

If you have found this helpful please hit that 👏 and share it on social media :).