Navneet
Navneet

Reputation: 9838

Django views architecture

I'm new to django and had a question regarding organizing views. manage.py startapp creates a views.py in my app folder. But django-admin.py startproject <name> does not create a corresponding views.py file in the <project_name>/<project_name> folder.

I find it intuitive to have global views which do not correspond to a particular app. For example, a login page would and should be independent of any app that I create (its associated with the django auth app). So, would it make sense to create another views.py in the <project_name>/<project_name> folder where I can define such views?

(Just wanted to run it by experienced djangoers before I proceed.)

Thanks.

Upvotes: 2

Views: 272

Answers (1)

Siva Arunachalam
Siva Arunachalam

Reputation: 7740

  • You can write your global views anywhere. it can be in any file name (I use, global_views.py)
  • I used to write a global to overrride/customize the default framework apps like custom authentication backend and custom sites.
  • Better to create a custom app and write all the global views.

Upvotes: 1

Related Questions