Gabi Cavalcante
dev python | pyladies | let's talk about tests and QA/QE




1 | $ pip install flask
2 | $ mkdir hello_world_flask
3 | $ cd hello_world_flask
from flask import Flask app = Flask(__name__) @app.route("/") def hello_world(): return "Hello World!" if __name__ == "__main__":app.run()
rodando sua criação:
5 | $ python app.py* Running on http://127.0.0.1:5000/
from flask import Flask app = Flask(__name__) @app.route("/") def hello_world(): return "Hello World!" if __name__ == "__main__":app.run()

@app.route('/')
def index():
return 'Index Page'
@app.route('/hello')
def hello():
return 'Hello World'
@app.route('/user/<username>')
def show_user_profile(username):
return 'User %s' % username
@app.route('/user/<int:age>')
def show_post(post_id):
return 'Post %d' % post_id
| int | accepts integers |
| float | like int but for floating point values |
| path |
like the default but also accepts slashes |
from flask import render_template@app.route('/hello/<name>') def show_post(name=None): return render_template('hello.html', name=name)
<!doctype html> <title>Hello Ladies</title> {% if name %} <h1>Hello {{ name }}!</h1> {% else %} <h1>Hello World!</h1> {% endif %}

git init
Você pode propor mudanças (adicioná-las ao Index) usando
git add <arquivo>git add --all
Este é o primeiro passo no fluxo de trabalho básico do git. Para realmente confirmar estas mudanças (isto é, fazer um commit), use
git commit -m "comentários das alterações"
Agora o arquivo é enviado para o HEAD, mas ainda não para o repositório remoto.
git push origin master
lady = {nome : "Gabriela",apelido : "Gabi",email : "gabi@gmail.com"}
|
|
By Gabi Cavalcante