Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Workshop Django
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Luiz Menezes
February 20, 2016
Programming
270
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Workshop Django
Oficina de Django apresentada no Opensanca.
Luiz Menezes
February 20, 2016
More Decks by Luiz Menezes
See All by Luiz Menezes
async é bom, async eu gosto
luizmenezes
0
58
Processando textos enormes com ferramentas "Unix"
luizmenezes
0
73
Testando aplicações web com py.test e selenium
luizmenezes
0
160
Python 3 Orientado a Objetos
luizmenezes
3
340
Expondo o Raspberry Pi via servidor web
luizmenezes
0
100
Bottle Admin
luizmenezes
0
110
IoT, Raspberry Pi e Python
luizmenezes
1
92
Coding Dojo
luizmenezes
0
74
Other Decks in Programming
See All in Programming
AIと壁打ちしながら進めるコスト管理
fufuhu
2
1.5k
「寝てても仕事が進む」Claude Codeで組む第二の脳
tomoyafujita2016
0
350
Gmail/Google DriveをトリガーにAIエージェントを動かそう! / Run AI agents with Gmail/Google Drive as triggers!
har1101
2
420
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
240
コンパウンドプロダクト開発のためのローカルプロセスマネージャー再発明 #layerxgo
izumin5210
0
150
Oxlintはいいぞ(続)
yug1224
1
390
Flow は今どうなっているか
mizdra
PRO
0
680
AIに既存システムを理解させる技術 ~レガシーを見捨てないハーネスエンジニアリング入門~
ochtum
0
140
Jindong: Introducing Declarative Haptics in Compose Multiplatform
l2hyunwoo
0
130
ソフトウェアエンジニアにとっての生成AI - 特性を知って使い倒す / generative ai for software enginner
kishida
7
2.1k
承認済みなのに差戻しできてしまうバグ、型で潰せます
shinchit
0
100
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
200
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.3k
Six Lessons from altMBA
skipperchong
29
4.5k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Unsuck your backbone
ammeep
672
58k
Un-Boring Meetings
codingconduct
0
390
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
380
Designing for Performance
lara
611
70k
HDC tutorial
michielstock
2
810
Transcript
Django Workshop
1. Python
▷ Simples, enxuta e poderosa ▷ Pilhas inclusas ▷ Interpretada
e dinâmica ▷ Comunidade ativa e amigável Python?
▷ Web ◦ Django, Flask, Bottle, Web2py, pyramid, twisted, ...
▷ Programação científica ◦ SciPy, scikit-learn, pandas, NumPy, IPython, matplotlib ▷ Desktop ◦ PyQT, PyGTK, WxPython, tkinter ▷ Cinema ◦ Autodesk Maya, Blender, Nuke, ILM Python: aplicações
▷ InfoSec ◦ Scapy ▷ Internet of Things ◦ MicroPython
▷ Educação ◦ "Python is Now the Most Popular Introductory Teaching Language at Top U.S. Universities" (ACM, 2014) Python: aplicações
▷ IronPython ▷ Jython ▷ PyJS, Brython ▷ PyPy (JIT)
Python: aplicações
PyCon 2015
PyCon 2015
Python Brasil 2014
Python Brasil 2015
2. Django The web framework for perfectionists with deadlines.
▷ Full stack framework ▷ MVT (Model-View-Template) Django
Django: quem usa? ▷ Disqus ▷ Instagram ▷ Mozilla ▷
Pinterest ▷ G1 ▷ Magazine Luiza
3. Instalando Python & Django
Instalando Python 3.5 ▷ Windows: https://www.python.org/downloads/releas e/python-351/
Instalando Python 3.5 ▷ Ubuntu ◦ sudo apt-get install python3.5
▷ Fedora ◦ sudo yum install python3.5 ▷ OS X ◦ https://www.python.org/downloads/rel ease/python-342/
Ambiente virtual (virtualenv) ▷ Para que serve? ◦ É uma
ferramenta que mantem dependências de projetos diferentes em locais separados ◦ Permite trabalhar em um projeto usando o Django 1.9 enquanto mantém um projeto antigo que usa Django 1.5
Ambiente virtual (virtualenv) ▷ Como funciona? ◦ O virtualenv cria
uma pasta com as dependências e executáveis que o projeto python necessita
Ambiente virtual (virtualenv) ▷ Sintaxe de criação do ambiente virtual
(linux) python3 -m venv <nome do env> (win) C:\Python35\python -m venv <nome do env> ▷ Criando o env (linux) python3 -m venv env (win) C:\Python35\python -m venv env
Ambiente virtual (virtualenv) ▷ Ativando o ambiente (linux) source env/bin/activate
(win) env\Scripts\activate ▷ Ao ativar o ambiente deverá aparecer (env) no começo de cada linha do terminal
▷ https://pypi.python.org/pypi ▷ Engloba "todos" os pacotes disponíveis para o
Python PyPI: the Python Package Index
▷ pip serve para instalar pacotes disponíveis no PyPI ▷
pip significa "pip instala pacotes" ▷ Como usar: pip install <nome do pacote> pip: instalando pacotes do PyPI
▷ Instalando o django pip install django e-commerce Projeto Django
e-commerce Projeto Django ▷ Criando o projeto (linux) django-admin startproject
ecom (win) python env\Scripts\django-admin.py starproject ecom ▷ Estrutura ▷ Configurando ◦ Timezone ◦ Arquivos estáticos
▷ Preparando o banco de dados python manage.py migrate ▷
Rodando o projeto python manage.py runserver ▷ Endereço do projeto ◦ http://127.0.0.1:8000/ e-commerce Projeto Django
▷ Criando uma aplicação python manage.py startapp ecommerce ▷ Estrutura
de uma aplicação ▷ Instalando a aplicação e-commerce Aplicação Django
▷ Modelo ◦ User ◦ Produto ◦ Carrinho ◦ Compra
▷ Criando as tabelas ◦ python manage.py makemigrations ecommerce ◦ python manage.py migrate ecommerce e-commerce Modelos
▷ Habilitando o Produto ▷ Página de administração ▷ Superusuário
▷ Cadastro de produtos e-commerce Adminstração
▷ Como funcionam ▷ Regex ◦ ex: http://site.com/usuario/12345 ▷ Criando
ecommerce/urls.py e-commerce URLs
▷ Criando a lista dos produtos ◦ View ◦ Template
HTML ◦ Queryset ◦ Linguagem de template e-commerce Views, Template e ORM
▷ Melhorando a aparência ◦ Template base ◦ Bootstrap http://getbootstrap.com
e-commerce Template
▷ Página do produto ▷ Carrinho de compras ▷ Checkout
(compra) e-commerce Mais funcionalidades
▷ Deploy git & pythonanywhere ◦ http://tutorial.djangogirls.org/pt/deploy/index.html ▷ Autenticação ◦
https://docs.djangoproject.com/en/1.9/topics/auth/ ▷ Customizar o admin ◦ https://docs.djangoproject.com/en/1.9/intro/tutorial 02/#introducing-the-django-admin ◦ melhorar listagem dos produtos ◦ incluir carrinho e-commerce Extra
▷ Materiais ◦ http://tutorial.djangogirls.org/pt/index.html ◦ https://docs.djangoproject.com/en/1.9/intro/tutorial 01/ ◦ http://www.codecademy.com/tracks/web ◦
http://www.codecademy.com/en/tracks/python ◦ https://docs.djangoproject.com/en/1.9/topics/ E depois?
▷ Ainda mais funcionalidades ◦ Autenticação login, logout, cadastro ◦
Perfil do usuário editar dados, listar pedidos ◦ Categorias de produtos ◦ Melhorar ▪ modelos (criar modelos, adicionar campos) ▪ página do produto (exibir mais informações) ▪ compra (descontos, frete, passo-a-passo) ▪ layout (HTML/CSS) e-commerce E depois?
▷ grupy-sanca meetup.com/grupy-sanca ▷ PyLadies São Carlos saocarlos.pyladies.com ▷ Opensanca
opensanca.com.br meetup.com/opensanca E depois?
Obrigado! Dúvidas? Contato: @luiz_amf
[email protected]
Credits Special thanks to all the people who made and
released these awesome resources for free: ▷ Presentation template by SlidesCarnival ▷ How to install python by Django Girls Tutorial