S
S
Serufim2018-03-12 18:55:18
Django
Serufim, 2018-03-12 18:55:18

Where to store view for main page in Django?

Hello everyone, I'm actively learning Django and I have a very strange question. The documentation says that nothing needs to be stored in the main application, and all code should live in modules, but I literally do not understand one thing, and where to store the main page for the "/" route in urls.py. Is it right to connect a separate index application where there will be only 1 route that will give a view and how best to store general statics, such as css files and js code, because duplicating them by modules is not the best option

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Astrohas, 2018-03-12
@Serufim

well, I usually do one of two things:
1) If the page is single, and no other such rogues will pop it into [ProjectName]/views.py . Project_name is a folder with files like settings.py and so on and so forth.
2) In all other cases, I create a new application of the main type and shove all sorts of main pages and other features there

S
Sergey Gornostaev, 2018-03-12
@sergey-gornostaev

Recommendations should not be taken as unbreakable rules. Some views related to the functionality common to the entire project, it is quite possible to store in the root application.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question