Add-on components that enhance and customize the Visual Studio integrated development environment
A maintainable Django application is typically structured by separating site-level configuration from app-level functionality.
- A Django project contains the site-wide configuration files such as
settings.py,urls.py,wsgi.py, and__init__.py. - A Django app is a separate Python package for a specific purpose and contains its own
views,models,tests,forms, and related folders such astemplates,migrations, andstatic.
This separation scales well because a single Django project can contain multiple apps, and each app can represent a distinct area of functionality. For example, different routes or features can be handled by different apps while the Django project manages overall settings and URL routing.
A practical structure in Visual Studio is:
- Keep the Django project folder for site-level files:
-
settings.py -
urls.py -
wsgi.py
-
- Keep each feature area in its own app folder.
- Store HTML templates inside the app’s
templatesfolder. - Store static assets such as CSS and JavaScript in the app’s
staticfolder. - Keep database schema changes in the app’s
migrationsfolder. - Keep request handling in
views.pyand data definitions inmodels.py.
For larger applications, this approach improves maintainability because:
- feature code stays grouped together
- site-wide configuration stays centralized
- templates and static files remain organized by app
- apps can be added as the project grows
In Visual Studio, app creation can also be standardized by using the Django app template or the Add > Django app command. That helps start each app with a consistent default structure.
If using the full Django Web Project template in Visual Studio, the generated structure already follows this pattern:
- project root with
manage.py, database file, and requirements - an app folder containing views, models, tests, forms, templates, migrations, and static content
- a Django project folder containing
settings.py,urls.py, andwsgi.py
For page organization, use template inheritance so shared layout, navigation, and scripts stay in a base template such as layout.html, while individual pages override content blocks. This reduces duplication and makes UI changes easier across the whole application.
Also keep manage.py as the project entry point in Visual Studio. The documented Django project support depends on that file.
- Tutorial: Work with the Django web framework in Visual Studio
- Tutorial: Create a Django app with views and page templates in Visual Studio
- Tutorial: Serve static files and use template inheritance with Django in Visual Studio
- Tutorial: Use the full Django Web Project template in Visual Studio
- Django Web Project templates for Python in Visual Studio