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
60
Testando aplicações web com py.test e selenium
luizmenezes
0
140
Python 3 Orientado a Objetos
luizmenezes
3
300
Expondo o Raspberry Pi via servidor web
luizmenezes
0
89
Bottle Admin
luizmenezes
0
100
IoT, Raspberry Pi e Python
luizmenezes
1
79
Coding Dojo
luizmenezes
0
57
Other Decks in Programming
See All in Programming
大規模アプリのDIフレームワーク刷新戦略 ~過去最大規模の並行開発を止めずにアプリ全体に導入するまで~
mot_techtalk
0
380
ИИ-Агенты в каждый дом – Алексей Порядин, PythoNN
sobolevn
0
150
Your Perfect Project Setup for Angular @BASTA! 2025 in Mainz
manfredsteyer
PRO
0
120
GitHub Actions × AWS OIDC連携の仕組みと経緯を理解する
ota1022
0
240
『毎日の移動』を支えるGoバックエンド内製開発
yutautsugi
2
180
アメ車でサンノゼを走ってきたよ!
s_shimotori
0
140
iOS 17で追加されたSubscriptionStoreView を利用して5分でサブスク実装チャレンジ
natmark
0
580
止められない医療アプリ、そっと Swift 6 へ
medley
1
120
Go言語の特性を活かした公式MCP SDKの設計
hond0413
1
180
GraphQL×Railsアプリのデータベース負荷分散 - 月間3,000万人利用サービスを無停止で
koxya
1
1.1k
開発生産性を上げるための生成AI活用術
starfish719
1
170
Swift Concurrency - 状態監視の罠
objectiveaudio
2
450
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.2k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.1k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
54
3k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.7k
Building Adaptive Systems
keathley
43
2.8k
Done Done
chrislema
185
16k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
358
30k
How STYLIGHT went responsive
nonsquared
100
5.8k
Learning to Love Humans: Emotional Interface Design
aarron
274
40k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
Side Projects
sachag
455
43k
A better future with KSS
kneath
239
17k
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