Skip to content

Instantly share code, notes, and snippets.

@SahbiOuali13
Last active September 25, 2022 09:07
Show Gist options
  • Save SahbiOuali13/d59ab5a6183e9798818a6edb8637d13e to your computer and use it in GitHub Desktop.
Save SahbiOuali13/d59ab5a6183e9798818a6edb8637d13e to your computer and use it in GitHub Desktop.
# Necessary Modules: - AutoDocstring: Python Docstring Genearator ![](https://cdn.cacher.io/attachments/u/3d66b3pypor7b/9XS2q6pWmavgYBO4FSe-_h5PDfUggYK4/8r4krhuur.png) # Parameters: - Nice fonts: 'Cascadia code' ![](https://cdn.cacher.io/attachme

Lanch configuration to run a django server

  • Go to Run and Debug
  • Go to Add Configuration

  • Django

  • Add the way to your manage.py relatively to where your launched VS Code.

    "version": "0.1.0",
    "configurations": [
        {"name":"Python : Django",
        "type":"python",
        "request":"launch",
        "program":"${workspaceFolder}\\src\\manage.py",
        "args":["runserver"],
        "django":true}
    ]
}
  • Run your local server here

Open all the file in cwd with VS code

  • code .
{
"editor.hover.enabled": false,
"autoDocstring.docstringFormat": "google",
"editor.renderControlCharacters": true,
"runInTerminal.commands": [
],
"workbench.colorTheme": "Community Material Theme",
"workbench.iconTheme": "material-icon-theme",
"kite.showWelcomeNotificationOnStartup": false,
"workbench.settings.useSplitJSON": true,
"python.autoComplete.extraPaths": [
],
"code-runner.fileDirectoryAsCwd": true,
"code-runner.saveFileBeforeRun": true,
"python.defaultInterpreterPath": "C:\\Users\\ouali\\AppData\\Local\\Programs\\Python\\Python39\\python.exe",
"git.ignoreWindowsGit27Warning": true,
"code-runner.runInTerminal": true,
"workbench.colorCustomizations": {
"activityBarBadge.background": "#5C6BC0",
"activityBar.activeBorder": "#5C6BC0",
"list.activeSelectionForeground": "#5C6BC0",
"list.inactiveSelectionForeground": "#5C6BC0",
"list.highlightForeground": "#5C6BC0",
"scrollbarSlider.activeBackground": "#5C6BC050",
"editorSuggestWidget.highlightForeground": "#5C6BC0",
"textLink.foreground": "#5C6BC0",
"progressBar.background": "#5C6BC0",
"pickerGroup.foreground": "#5C6BC0",
"tab.activeBorder": "#5C6BC0",
"notificationLink.foreground": "#5C6BC0",
"editorWidget.resizeBorder": "#5C6BC0",
"editorWidget.border": "#5C6BC0",
"settings.modifiedItemIndicator": "#5C6BC0",
"settings.headerForeground": "#5C6BC0",
"panelTitle.activeBorder": "#5C6BC0",
"breadcrumb.activeSelectionForeground": "#5C6BC0",
"menu.selectionForeground": "#5C6BC0",
"menubar.selectionForeground": "#5C6BC0",
"editor.findMatchBorder": "#5C6BC0",
"selection.background": "#5C6BC040",
"statusBarItem.remoteBackground": "#5C6BC0",
"[Material Theme]": {}
},
"files.autoSave": "afterDelay",
"terminal.integrated.automationShell.windows": "",
"terminal.integrated.automationShell.linux": "",
"editor.fontWeight": null,
"editor.codeActionsOnSave": null,
"workbench.editorAssociations": {
"*.ipynb": "jupyter-notebook",
"*.db": "default"
},
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"jupyter.askForKernelRestart": false,
"notebook.cellToolbarLocation": {
"default": "right",
"jupyter-notebook": "left"
},
"editor.fontLigatures": true,
"terminal.integrated.defaultProfile.windows": "C:\\Program Files\\Git\\bin\\bash.exe (migrated)",
"python.analysis.typeCheckingMode": "basic",
"editor.fontSize": 16,
"editor.fontFamily": " 'Cascadia Code', Consolas, 'Courier New', monospace",
"editor.cursorBlinking": "expand",
"editor.wordWrap": "wordWrapColumn",
"settingsSync.ignoredExtensions": [
],
"zenMode.hideLineNumbers": false,
"terminal.integrated.profiles.windows": {
"C:\\Program Files\\Git\\bin\\bash.exe (migrated)": {
"path": "C:\\Program Files\\Git\\bin\\bash.exe",
"args": []
}
},
//"terminal.integrated.fontFamily": "Cascadia Code",
// to resolve glyph displaying problems with oh-my-posh
"terminal.integrated.fontFamily": "CaskaydiaCove NF",
"python.analysis.diagnosticMode": "workspace",
"python.formatting.provider": "black",
"python.formatting.blackArgs":[
"--line-length",
"79",
"-t",
// "-S",
"py36"
],
"python.languageServer": "Pylance",
"python.terminal.activateEnvironment": true,
"python.analysis.extraPaths": [],
// "python.linting.enabled": true,
// "python.linting.banditEnabled": true,
// "python.linting.pylintEnabled": true,
// "python.linting.lintOnSave": true,
"python.envFile": "${workspaceFolder}/.env",
"[python]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {"source.organizeImports": true},
"editor.rulers": [
79,
]
},
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
".vscode": true,
"**/*.pyc": true,
// ".venv": true,
},
"emmet.includeLanguages": {
"python": "html",
"javascript": "html",
"django-html": "html",
"jinja-html": "html",
},
"[django-html]": {
// "editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.quickSuggestions": {
"comments": true,
"other": true,
"strings": true
},
"editor.tabSize": 4,
"editor.wordWrap": "on"
},
"files.associations": {
// "**/*.html": "html",
"**/*.html": "django-html",
"**/templates/**/*.html": "django-html",
"**/templates/**/*": "django-txt",
"**/requirements{/**,*}.{txt,in}": "pip-requirements",
},
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
}

Auto formatting, sort imports on save and pep8 max length to 80

  • open settings.json and add:
  ...
   "[python]": {
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {"source.organizeImports": true},
        "editor.rulers": [
            79,            
        ]
    }

html support into python and javascript files

...,
"emmet.includeLanguages": {
        "python": "html",
        "javascript": "html",
        "django-html": "html",
      },
...

Django tags and filters support in vs code

    ...,
    "emmet.includeLanguages": {
        "python": "html",
        "javascript": "html",
        "django-html": "html",
    },
    "AREPL.defaultImports": [
    
        "from arepl_dump import dump"
    ],
    "[django-html]": {

        "editor.quickSuggestions": {
            "other": true,
            "comments": true,
            "strings": true
        }
    },
    "files.associations": {
        "**/*.html": "html",
        "**/templates/**/*.html": "django-html",
        "**/templates/**/*": "django-txt",
        "**/requirements{/**,*}.{txt,in}": "pip-requirements"
    },
    "html.format.contentUnformatted": "",
  ...
}

Ignore files in project

"files.exclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        ".vscode": true,
        "**/*.pyc": true,
        ".venv": true,
    },
  • ctrl + , --> opens settings tabta
  • aaron-bond.better-comments
  • alefragnani.Bookmarks
  • almenon.arepl
  • batisteo.vscode-django
  • christian-kohler.path-intellisense
  • coddx.coddx-alpha
  • CoenraadS.bracket-pair-colorizer-2
  • cstrap.python-snippets
  • dongli.python-preview
  • donjayamanne.python-environment-manager
  • eamodio.gitlens
  • earshinov.permute-lines
  • Equinusocio.vsc-community-material-theme
  • Equinusocio.vsc-material-theme
  • esbenp.prettier-vscode
  • formulahendry.auto-rename-tag
  • formulahendry.code-runner
  • frhtylcn.pythonsnippets
  • GrapeCity.gc-excelviewer
  • hoovercj.vscode-power-mode
  • johnpapa.vscode-cloak
  • k--kato.intellij-idea-keybindings
  • kamikillerto.vscode-colorize
  • KevinRose.vsc-python-indent
  • mikestead.dotenv
  • ms-azuretools.vscode-docker
  • ms-python.python
  • ms-python.vscode-pylance
  • ms-toolsai.jupyter
  • ms-toolsai.jupyter-keymap
  • ms-toolsai.jupyter-renderers
  • ms-vscode-remote.remote-containers
  • ms-vscode-remote.remote-wsl
  • negokaz.live-server-preview
  • njpwerner.autodocstring
  • njqdev.vscode-python-typehint
  • PKief.material-icon-theme
  • pranaygp.vscode-css-peek
  • redhat.vscode-yaml
  • streetsidesoftware.code-spell-checker
  • teabyii.ayu
  • techer.open-in-browser
  • thebarkman.vscode-djaneiro
  • tomoki1207.pdf
  • tonybaloney.vscode-pets
  • VisualStudioExptTeam.vscodeintellicode
  • ZainChen.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment