Last active
August 24, 2022 14:02
-
-
Save renan778/af7ce0d603203691f65fc3cc88e76323 to your computer and use it in GitHub Desktop.
Site usando Flask
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="PT-BR"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Contatos</title> | |
</head> | |
<body> | |
<h3>Entre em contato conosco ! </h3> | |
<p>Nossos contatos são :</p> | |
<p>E-mail -> Renan.re2010@gmail.com</p> | |
<p>Tel -> (11)99701-3887</p> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="PT-BR"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Home Page</title> | |
</head> | |
<body> | |
<p> Nessa teste estamos mexendo tanto com Flask, HTML e Python ao mesmo tempo </p> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from distutils.log import debug | |
from flask import flask, render_template | |
app = flask(__name__) | |
#criar a primeira pagina | |
#route -> hashtagtreinamento.com/usuarios | |
#função -> o que voce quer exibir nessa pagina | |
# Templates | |
#sempre que colocarmos um @ chamamos de decoreto e usamos para acresentar uma nova funcionalidade para a def que vem logo abaixo | |
@app.route('/') #colocamos app por causa do nome do site, e colocamos essa barra porque iremos entrar no homepage. | |
def homepage(): | |
#tudo que vc quiser que no site tem que colocar dentro do return | |
return render_template('homepage.html') | |
@app.route('/contatos') | |
def contatos(): | |
return render_template('contatos.html') | |
@app.route('/usuarios/<nome_usuario>') | |
def usuarios(nome_usuario): | |
return render_template('usuarios.html', nome_usuario=nome_usuario) | |
#colocar o site no ar | |
if __name__ == '__main__': | |
app.run(debug=True) #fazendo essa função toda vez que formos fazer alguma edição no site não precisamos pausar o script, ele ira sempre ja levantar automaticamente as alterações | |
# servidor do Heroku | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="PT-BR"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Perfil de Usuários</title> | |
</head> | |
<body> | |
<p>Meu Nome é {{ nome_usuario }} </p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment