Ranjeet Karki
Ranjeet Karki

Reputation: 2647

Can we make many views.py in Django as a Controller?

Iam new to Django Framework and just started learning django 1.8. In other framework Like Laravel,Rails there we can make different controller file. for example UserController.php,ContactController.php etc.

I think in Django, views.py is similar to Controller and In django ,in views.py i have a long line of code of more than 300 lines and i want to make my code clean by making seperate views.py for userRegistration,Contact,ArticleControl etc. My question is how can i achieve this ie:making many views.py like controller

Upvotes: 1

Views: 750

Answers (1)

Manish Gupta
Manish Gupta

Reputation: 4666

Instead of multiple views.py, You can divide your application into individual applications within your project. Like separate applications for userRegistration, Contact, ArticleControl. this way your code will look much cleaner. And in case of any bug you will be able to debug that specific application easily.

Upvotes: 4

Related Questions