sublime text3 for django development

Post on 29-Jan-2018

928 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Sublime Text3

for Django Development @starwilly

Integrated development environmentIDE

Text Editor

Why Sublime Text

• Lightweight

• Speed

• Cross Platform (Windows, OS X, Linux)

• Package Control

• Community

Let’s get started

Keyboard Shortcuts

• Command Palettes: Cmd+ Shift + P / Ctrl + Shift + P

• Navigation

• Quick Open File: Cmd + P / Ctrl + P

• Go to Symbol: Cmd + R / Ctrl + R

• Go To Line: Ctrl + G

Package

Package Control Installation

https://packagecontrol.io/installation

1. Open Sublime Text Console: Ctrl+` 2. Paste the following code

Install Package• Open Command Palettes (Cmd + Shift + P)

• Type “install” then Search Package Name

SidebarEnhancements

https://github.com/titoBouzout/SideBarEnhancements

AdvancedNewFile• Cmd + Shift + n / Ctrl + Alt + n

• Tab Autocompletion

Anaconda

• Auto Completion • Code Linting (use sublimelinter) • Import Validation • Goto Definition • Tests Runner • McCabe Complexity Checker • …

Turns your Sublime Text 3 into a full featured Python development IDE

http://damnwidget.github.io/anaconda/

Anaconda

Show Documentation

Anaconda

Goto Definition

Configure Anaconda

{ "python_interpreter": "$VIRTUAL_ENV/bin/python", }

{ "anaconda_linting": false, "python_interpreter": "/home/damnwidget/.virtualenvs/anaconda/bin/python" }

Virtualenv environment variables

Virtualenv support

http://damnwidget.github.io/anaconda/anaconda_settings/

Djaneiro• Template:

• block => {% block %} {% endblock %}

• tag => {% %}

• var => {{ }}

• View

• view, createview, templateview …https://github.com/squ1b3r/Djaneiro

Djaneiro• Model:

• Model

• mchar => models.CharField()

• fk => models.ForeignKey()

• Form:

• fchar => forms.CharField()

• fchoice => forms.ChoiceField()

Linterhurt your feelings

but

help your code better

SublimeLinter

• A Framework for ST3 Linters

• Linter must be installed separately

• SublimeLinter-pyflakes, SublimeLinter-pep8

• and more (jslint, csslint …)

Installation

• Install SublimeLinter

• pip install pep8

• Install SublimeLinter-pep8 (by package control)

• Linter configuration

Find Linter Executable

# Mac OS X, Linux hash -r which python

# Windows where python

Add to Path (Two Options) 1. Add the path to the “paths” global setting. 2. On Mac OS X or Linux, adjust your shell startup files

On Windows, add PATH environment variable.

Find Linter location

Linter Config

Linting

Front End

Bootstrap 3 Snippet• Use Command Palettes to find: Cmd + Shift + P

• bs3-input-group-btn

• bs3-form-forizontal

• …

Emmet (Zen Coding)• HTML Abbreviation (CSS selector-like syntax)#page>div.logo+ul#navigation>li*5>a{Item $}

fl

bgc

http://docs.emmet.io/cheat-sheet/

w15+h20+mb15+mr20

• CSS code snippets

bpython• a fancy interface to the Python interpreter

pip install bpython

Thank you

• SidebarEnhancement https://github.com/titoBouzout/SideBarEnhancements

• AdvancedNewFilehttps://github.com/skuroda/Sublime-AdvancedNewFile

• Anacondahttp://damnwidget.github.io/anaconda/

• Djaneirohttps://github.com/squ1b3r/Djaneiro

• SublimeLinter

https://github.com/SublimeLinter/SublimeLinter3

Pyflakes https://github.com/SublimeLinter/SublimeLinter-pyflakes PEP8 https://github.com/SublimeLinter/SublimeLinter-pep8

• Bootstrap 3 Snippet https://github.com/JasonMortonNZ/bs3-sublime-plugin

• Emment http://emmet.io/

• bpythonhttp://bpython-interpreter.org/

top related