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
Luiz Menezes
February 20, 2016
Programming
2
250
Workshop Django
Oficina de Django apresentada no Opensanca.
Luiz Menezes
February 20, 2016
Tweet
Share
More Decks by Luiz Menezes
See All by Luiz Menezes
async é bom, async eu gosto
luizmenezes
0
48
Processando textos enormes com ferramentas "Unix"
luizmenezes
0
59
Testando aplicações web com py.test e selenium
luizmenezes
0
140
Python 3 Orientado a Objetos
luizmenezes
3
280
Expondo o Raspberry Pi via servidor web
luizmenezes
0
88
Bottle Admin
luizmenezes
0
100
IoT, Raspberry Pi e Python
luizmenezes
1
76
Coding Dojo
luizmenezes
0
55
Other Decks in Programming
See All in Programming
「ElixirでIoT!!」のこれまでとこれから
takasehideki
0
370
生成AIコーディングとの向き合い方、AIと共創するという考え方 / How to deal with generative AI coding and the concept of co-creating with AI
seike460
PRO
1
330
ニーリーにおけるプロダクトエンジニア
nealle
0
100
git worktree × Claude Code × MCP ~生成AI時代の並列開発フロー~
hisuzuya
1
420
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
45
30k
Kotlin エンジニアへ送る:Swift 案件に参加させられる日に備えて~似てるけど色々違う Swift の仕様 / from Kotlin to Swift
lovee
1
250
Cline指示通りに動かない? AI小説エージェントで学ぶ指示書の書き方と自動アップデートの仕組み
kamomeashizawa
1
570
童醫院敏捷轉型的實踐經驗
cclai999
0
180
第9回 情シス転職ミートアップ 株式会社IVRy(アイブリー)の紹介
ivry_presentationmaterials
1
230
GraphRAGの仕組みまるわかり
tosuri13
7
480
アンドパッドの Go 勉強会「 gopher 会」とその内容の紹介
andpad
0
260
既存デザインを変更せずにタップ領域を広げる方法
tahia910
1
240
Featured
See All Featured
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.4k
GitHub's CSS Performance
jonrohan
1031
460k
A Modern Web Designer's Workflow
chriscoyier
693
190k
The World Runs on Bad Software
bkeepers
PRO
69
11k
Designing Experiences People Love
moore
142
24k
A Tale of Four Properties
chriscoyier
160
23k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Mobile First: as difficult as doing things right
swwweet
223
9.7k
Unsuck your backbone
ammeep
671
58k
The Cult of Friendly URLs
andyhume
79
6.5k
The Cost Of JavaScript in 2023
addyosmani
51
8.4k
Visualization
eitanlees
146
16k
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