You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
219 lines
5.7 KiB
219 lines
5.7 KiB
11 years ago
|
<!doctype html>
|
||
|
<html lang="en">
|
||
|
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
|
||
|
<title>Flask</title>
|
||
|
|
||
|
<meta name="author" content="Julio Biason">
|
||
|
|
||
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||
|
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||
|
|
||
|
<link rel="stylesheet" href="http://cdn.jsdelivr.net/reveal.js/2.6.2/css/reveal.min.css">
|
||
|
<link rel="stylesheet" href="http://cdn.jsdelivr.net/reveal.js/2.6.2/css/theme/default.css" id="theme">
|
||
|
|
||
|
<!-- For syntax highlighting -->
|
||
|
<link rel="stylesheet" href="http://cdn.jsdelivr.net/reveal.js/2.6.2/lib/css/zenburn.css">
|
||
|
|
||
|
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
|
||
|
<script>
|
||
|
if( window.location.search.match( /print-pdf/gi ) ) {
|
||
|
var link = document.createElement( 'link' );
|
||
|
link.rel = 'stylesheet';
|
||
|
link.type = 'text/css';
|
||
|
link.href = 'http://cdn.jsdelivr.net/reveal.js/2.6.2/css/print/pdf.css';
|
||
|
document.getElementsByTagName( 'head' )[0].appendChild( link );
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<!--[if lt IE 9]>
|
||
|
<script src="reveal.js/lib/js/html5shiv.js"></script>
|
||
|
<![endif]-->
|
||
|
|
||
|
<style>
|
||
|
.semi-opaque {
|
||
|
background-color: rgba(0, 0, 0, 0.7);
|
||
|
}
|
||
|
|
||
|
* {
|
||
|
hyphens: none !important;
|
||
|
-moz-hyphens: none !important;
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
|
||
|
<div class="reveal">
|
||
|
<!-- Any section element inside of this container is displayed as a slide -->
|
||
|
<div class="slides">
|
||
|
<section data-background='_images/flask.png'>
|
||
|
<h1>Flask</h1>
|
||
|
</section>
|
||
|
|
||
|
<section>
|
||
|
<h2>O que é Flask?</h2>
|
||
|
|
||
|
<ul>
|
||
|
<li>Microframework web em Python.</li>
|
||
|
<li>Framework sobre o Werkzeug (outro framework).</li>
|
||
|
<li>Sem ORM, mas templates.</li>
|
||
|
</ul>
|
||
|
</section>
|
||
|
|
||
|
<section>
|
||
|
<section>
|
||
|
<h2>Aplicativo Flask Básico</h2>
|
||
|
|
||
|
<p><pre><code data-trim>
|
||
|
from flask import Flask
|
||
|
app = Flask(__name__)
|
||
|
|
||
|
@app.route('/')
|
||
|
def index():
|
||
|
return 'Hello world'
|
||
|
</code></pre></p>
|
||
|
</section>
|
||
|
|
||
|
<section data-transition='none'>
|
||
|
<p><pre><code data-trim>
|
||
|
#!/usr/bin/env python
|
||
|
# -*- encoding: utf-8 -*-
|
||
|
|
||
|
from flask import Flask
|
||
|
app = Flask(__name__)
|
||
|
|
||
|
@app.route('/')
|
||
|
def index():
|
||
|
return 'Hello world'
|
||
|
</code></pre></p>
|
||
|
<p><small>... mais o header...</small></p>
|
||
|
</section>
|
||
|
|
||
|
<section data-transition='none'>
|
||
|
<p><pre><code data-trim>
|
||
|
#!/usr/bin/env python
|
||
|
# -*- encoding: utf-8 -*-
|
||
|
|
||
|
"""Meu aplicativo web em Flask."""
|
||
|
|
||
|
from flask import Flask
|
||
|
app = Flask(__name__)
|
||
|
|
||
|
@app.route('/')
|
||
|
def index():
|
||
|
return 'Hello world'
|
||
|
</code></pre></p>
|
||
|
<p><small>... mais a documentação do módulo...</small></p>
|
||
|
</section>
|
||
|
|
||
|
<section data-transition='none'>
|
||
|
<p><pre><code data-trim>
|
||
|
#!/usr/bin/env python
|
||
|
# -*- encoding: utf-8 -*-
|
||
|
|
||
|
"""Meu aplicativo web em Flask."""
|
||
|
|
||
|
from flask import Flask
|
||
|
app = Flask(__name__)
|
||
|
|
||
|
@app.route('/')
|
||
|
def index():
|
||
|
"""Apresentação do 'root' do aplicativo."""
|
||
|
return 'Hello world'
|
||
|
</code></pre></p>
|
||
|
|
||
|
<p><small>... mais a documentação das funções...</small></p>
|
||
|
</section>
|
||
|
|
||
|
<section data-transition='none'>
|
||
|
<p><pre><code data-trim>
|
||
|
#!/usr/bin/env python
|
||
|
# -*- encoding: utf-8 -*-
|
||
|
|
||
|
"""Meu aplicativo web em Flask."""
|
||
|
|
||
|
from flask import Flask
|
||
|
from flask import render_template
|
||
|
|
||
|
app = Flask(__name__)
|
||
|
|
||
|
@app.route('/')
|
||
|
def index():
|
||
|
"""Apresentação do 'root' do aplicativo."""
|
||
|
return render_template('hello.html')
|
||
|
</code></pre></p>
|
||
|
|
||
|
<p><small>... mais retornar templates ao invés de texto puro...</small></p>
|
||
|
</section>
|
||
|
|
||
|
<section data-transition='none'>
|
||
|
<p><pre><code data-trim>
|
||
|
#!/usr/bin/env python
|
||
|
# -*- encoding: utf-8 -*-
|
||
|
|
||
|
"""Meu aplicativo web em Flask."""
|
||
|
|
||
|
class Settings:
|
||
|
SECRET_KEY = 'Sup3rs3cr33t'
|
||
|
|
||
|
from flask import Flask
|
||
|
from flask import render_template
|
||
|
|
||
|
app = Flask(__name__)
|
||
|
app.config.from_object(Settings)
|
||
|
app.config.from_envvar('MEU_APLICATIVO_CONFIG')
|
||
|
|
||
|
|
||
|
@app.route('/')
|
||
|
def index():
|
||
|
"""Apresentação do 'root' do aplicativo."""
|
||
|
return render_template('hello.html')
|
||
|
</code></pre></p>
|
||
|
|
||
|
<p><small>... mais adicionar uma configuração...</small></p>
|
||
|
</section>
|
||
|
</section>
|
||
|
|
||
|
<section>
|
||
|
<img src='_images/baby-steps.jpg'>
|
||
|
</section>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<script src="http://cdn.jsdelivr.net/reveal.js/2.6.2/lib/js/head.min.js"></script>
|
||
|
<script src="http://cdn.jsdelivr.net/reveal.js/2.6.2/js/reveal.min.js"></script>
|
||
|
|
||
|
<script>
|
||
|
|
||
|
// Full list of configuration options available here:
|
||
|
// https://github.com/hakimel/reveal.js#configuration
|
||
|
Reveal.initialize({
|
||
|
controls: true,
|
||
|
progress: true,
|
||
|
history: true,
|
||
|
center: true,
|
||
|
|
||
|
theme: 'night',
|
||
|
transition: 'linear',
|
||
|
|
||
|
// Optional libraries used to extend on reveal.js
|
||
|
dependencies: [
|
||
|
{ src: 'http://cdn.jsdelivr.net/reveal.js/2.6.2/lib/js/classList.js', condition: function() { return !document.body.classList; } },
|
||
|
{ src: 'http://cdn.jsdelivr.net/reveal.js/2.6.2/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
|
||
|
{ src: 'http://cdn.jsdelivr.net/reveal.js/2.6.2/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
|
||
|
{ src: 'http://cdn.jsdelivr.net/reveal.js/2.6.2/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
|
||
|
{ src: 'http://cdn.jsdelivr.net/reveal.js/2.6.2/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
|
||
|
{ src: 'http://cdn.jsdelivr.net/reveal.js/2.6.2/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
|
||
|
]
|
||
|
});
|
||
|
|
||
|
</script>
|
||
|
|
||
|
</body>
|
||
|
</html>
|