Django views in the project directory

I have a project with two applications with their respective views, but I want to create view.py in the django project directory for some common pages, for example, about registration ... Is it correct to put view.py and templates in the project root folder for this purpose?

+6
source share
2 answers

I do this for project-level pages as you describe. Usually these are simple pages that combine project applications and do not contain any business logic.

0
source

I read about it. To do this, it is recommended to use an application that creates a connection between other applications, call it web_site or a website, as you prefer.

python manage.py startapp my_site 

Everything in this site application will be done in the usual way. In URL projects, you can import the URLs so that web pages display in the / url pattern.

 urlpatterns = [ path('admin/', admin.site.urls), path('', include('my_site.urls')) ] 
0
source

Source: https://habr.com/ru/post/1260657/


All Articles