Django Web Project templates for Python in Visual Studio
Django is a high-level Python framework designed for rapid, secure, and scalable web development. Python support in Visual Studio provides several project templates to set up the structure of a Django-based web application.
The templates are available in Visual Studio under File > New > Project and include the Blank Django Web Project and Django Web Project. For a walkthrough of the templates, see the Work with the Django web framework in Visual Studio tutorial series.
Intellisense features
Visual Studio provides full IntelliSense support for Django projects, including the following features:
Context variables passed into the template:
Tagging and filtering for both built-ins and user-defined items:
Syntax coloring for embedded CSS and JavaScript elements:
Debugging support
Visual Studio also provides full debugging support for Django projects:
Django management console
The Django management console is accessed through various commands on the Django Project menu or by right-clicking the Django project in Solution Explorer.
Open Django Shell: Opens a shell in your application context that enables you to manipulate your models:
Django Sync DB: Runs the
manage.py syncdb
command in an Interactive Window:Collect Static: Runs the
manage.py collectstatic --noinput
command to copy all static files to the path specified by theSTATIC_ROOT
variable in your _settings.py file:Validate: Runs the
manage.py validate
command that reports any validation errors in the installed models specified by theINSTALLED_APPS
variable in your settings.py file:
Important
Django projects are typically managed through a manage.py file and Visual Studio follows this approach. If you stop using the manage.py file as the entry point, you essentially break the project file. In this case, you need to recreate the project from existing files without marking it as a Django project.