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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
57
Processando textos enormes com ferramentas "Unix"
luizmenezes
0
71
Testando aplicações web com py.test e selenium
luizmenezes
0
160
Python 3 Orientado a Objetos
luizmenezes
3
330
Expondo o Raspberry Pi via servidor web
luizmenezes
0
100
Bottle Admin
luizmenezes
0
110
IoT, Raspberry Pi e Python
luizmenezes
1
91
Coding Dojo
luizmenezes
0
73
Other Decks in Programming
See All in Programming
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
520
S3 を使うアプリケーションをローカル完結で動かすことに全力を注いでみた / Running S3 Apps Offline
contour_gara
0
530
komatsuna「分散システムにおけるバグ分析手法」
komatsunaqa
0
270
React本体のコードリーディング
high_g_engineer
1
150
Google Apps Script で Ruby を動かす
kawahara
0
270
関東Kaggler会_NVIDIA_Nemotron_コンペ_振り返り
rick_ds
0
650
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
1
250
改善しないと、タスクが回らない。 “てんこ盛りポジション” を引き継いだ情シスの、入社3ヶ月の業務改善録
krm963
0
270
テーブルをDELETEした
yuzneri
0
150
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
500
Laravelで学ぶ Webアプリケーションチューニング入門/web_application_tuning_101
hanhan1978
4
1.9k
琵琶湖の水は止められてもNet--HTTPのリトライは止められない / You might be able to stop the water flow of Lake Biwa but you can't stop Net::HTTP retries
luccafort
PRO
0
780
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
55
8.3k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.9k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
490
How to Think Like a Performance Engineer
csswizardry
28
2.7k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
580
Tell your own story through comics
letsgokoyo
1
1k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.8k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
800
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
How to train your dragon (web standard)
notwaldorf
97
6.8k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
650
Leo the Paperboy
mayatellez
8
2.2k
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