File tree Expand file tree Collapse file tree 4 files changed +65
-7
lines changed
Code/renan/html_css_flask Expand file tree Collapse file tree 4 files changed +65
-7
lines changed Original file line number Diff line number Diff line change 55
66#localhost:5000/
77@app .route ('/' )
8- def index ():
9- name = "Bill"
10- return render_template ('index.html' , name = name )
8+ def index ():
119
10+ return render_template ('index.html' )
11+
12+
13+ #run flask app by below command inputs
1214#$env:FLASK_APP= "app.py"
15+ #py -m flask run
16+ #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
17+
1318
19+ #change the location of the webpage ..change the name from home to - /about
20+ #previous route was just 5000/ which routed to index.html
1421@app .route ('/about' )
1522def about ():
16- return render_template ('about.html' )
23+
24+ return render_template ('about.html' )
25+
26+
Original file line number Diff line number Diff line change 88</ head >
99< body >
1010
11- < h1 > Welcome to my flask app </ h1 >
12- < p > Hello {{name}} </ p >
13-
11+ < h1 > Welcom to My flask App </ h1 >
12+
13+
1414</ body >
1515</ html >
Original file line number Diff line number Diff line change 1+ from flask import Flask , render_template
2+ import random
3+ import string
4+
5+ app = Flask (__name__ )
6+
7+
8+ #localhost:5000/
9+ @app .route ('/' )
10+ def index ():
11+
12+ letters = str (string .ascii_lowercase )
13+ # print(letters)
14+
15+ digits = string .digits
16+ # print(digits)
17+
18+ punctuation = string .punctuation
19+ # print(punctuation)
20+
21+ all_characters = letters + digits + punctuation
22+ # print(random.choice(all_characters))
23+
24+ # Password Generator
25+
26+ characters = []
27+
28+ while len (characters ) < 10 :
29+ characters .append (random .choice (all_characters ))
30+
31+ password = characters
32+
33+
34+ return render_template ('index.html' ,password = password )
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
6+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
7+ < title > Password Generatort</ title >
8+ </ head >
9+ < body >
10+ < h1 > Random Password Generator</ h1 >
11+ < p > Refresh Page To Get New Password</ p >
12+ < p > {{password}}</ p >
13+ </ body >
14+ </ html >
You can’t perform that action at this time.
0 commit comments