python - How do I break up the controllers (views) into cohesive files in a Django project? -
I am currently working through the tutorial on Django's website. By completing the following command:
Python manage.py startapp polls
This creates the following structure:
polls / __init__.py groups. As I was going through the tutorial, it has been seen that the idea file can grow in this huge uncomfortable monolithic file, in which the entire web application There is every action in it. Is there a way to break this file into unified squares or files? I tried to change settings.py and url.py to point to a different directory, but it seems that the script generating the file structure creates a "View" module when creating a file, and I have no way To change / override this behavior from the script that appears.
Each app you create for this project will have its own views.py
file (assuming using this idea), so you do not have to worry about it.
Just be sure to keep your app's functionality in mind.
From Django Docs:
Project vs. App
What is the difference between a project and an app? An app is a web application that does something - e.g., a weblog system, a public record database or a simple voting app. A project is a collection of applications for a particular web site and an application can have multiple applications in one project An app can be in many projects.
Comments
Post a Comment