Thanks to visit codestin.com
Credit goes to github.com

Skip to content

wderocco8/412-public

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

Tips and Tricks for "Easier" Django Development

Summary

This readme is designed to make your Django development (assuming with VSCode) a bit simpler and faster. It contains useful setup instructions, extensions, and settings to help optimize your workflow. Feel free to use the table of contents below to jump around. 🤠

Please let me know (open an issue, post on piazza, or email me at [email protected]) if you have any questions or suggestions for things to add!

Table of Contents

Table of Contents
  1. Select Python Interpreter
  2. Configure VSCode Emmet: Include Languages
  3. Useful VSCode extensions 🛠️🛠️

1. Select Python Interpreter

By default, VSCode my not assign the correct Python interpreter when opening your Django folder.

What's wrong with default interpreter:

  • you must run pipenv shell every time you re-open the project in order to use Django-related commands
  • Intellisense will not work and your code will likely be covered in warnings since the interpreter cannot recognize Django imports...

Solution

  1. get pipenv environment path

    # cd into your `django` directory 
    cd django
    
    # exctract and COPY the path of the virtual environment
    pipenv --venv
  2. update python interpreter in vscode

    • on mac: press cmd+shift+p (on windows: press ctrl+shift+p)
    • type "Python: Select Intepreter"
    • choose "Enter interpreter path..."
    • paste the path from pipenv --venv

You should only have to complete these steps once for you given django project!

Video walkthrough

Watch the video

2. Configure VSCode Emmet: Include Languages

This setup is used to configure abbreviations in languages that are not supported by default in VSCode. For you all, the most relevant one is Django-HTML (which is the file type that VSCode automtically recognizes for HTML files loated in your Django projects).

What's wrong not including Django-HTML:

  • By default, Emmet does not work in Django-HTML files. This means you won’t be able to use Emmet’s shorthand for expanding HTML elements, which can significantly slow down your workflow, especially when working with templates that contain a lot of HTML.

Solution

  1. Open your VSCode settings (Ctrl + , or Cmd + , on macOS).
  2. Search for Emmet: Include Languages in the settings search bar.
  3. Click on "Add item"go-HTML with HTML:

Demo

alt text

3. Useful VSCode extensions 🛠️🛠️

Below are a list of VSCode extensions that I personally use to make development a bit easier (especially when working with Django-HTML). Feel free to let us know if any are missing!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published