Skip to content

Commit

Permalink
Flask Redo Lab
Browse files Browse the repository at this point in the history
  • Loading branch information
renanharrigan committed Apr 1, 2022
1 parent 4eb9acd commit 662649a
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 7 deletions.
18 changes: 14 additions & 4 deletions Code/renan/html_css_flask/9_flask/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,22 @@

#localhost:5000/
@app.route('/')
def index():
name = "Bill"
return render_template('index.html', name=name)
def index():

return render_template('index.html')


#run flask app by below command inputs
#$env:FLASK_APP= "app.py"
#py -m flask run
#You will need to run the flask app each time to refresh your page...1st kill your terminal by Ctrl + C then type py -m flask run


#change the location of the webpage ..change the name from home to - /about
#previous route was just 5000/ which routed to index.html
@app.route('/about')
def about():
return render_template('about.html')

return render_template('about.html')


6 changes: 3 additions & 3 deletions Code/renan/html_css_flask/9_flask/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
</head>
<body>

<h1>Welcome to my flask app</h1>
<p>Hello {{name}}</p>
<h1>Welcom to My flask App</h1>


</body>
</html>
34 changes: 34 additions & 0 deletions Code/renan/html_css_flask/flask_redo/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from flask import Flask, render_template
import random
import string

app = Flask(__name__)


#localhost:5000/
@app.route('/')
def index():

letters = str(string.ascii_lowercase)
# print(letters)

digits = string.digits
# print(digits)

punctuation = string.punctuation
# print(punctuation)

all_characters = letters + digits + punctuation
# print(random.choice(all_characters))

# Password Generator

characters = []

while len(characters) < 10:
characters.append(random.choice(all_characters))

password = characters


return render_template('index.html',password=password)
14 changes: 14 additions & 0 deletions Code/renan/html_css_flask/flask_redo/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Password Generatort</title>
</head>
<body>
<h1>Random Password Generator</h1>
<p>Refresh Page To Get New Password</p>
<p>{{password}}</p>
</body>
</html>

0 comments on commit 662649a

Please sign in to comment.