Skip to content

Commit

Permalink
final commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shithij committed Jun 6, 2018
0 parents commit ae5862a
Show file tree
Hide file tree
Showing 2,577 changed files with 402,130 additions and 0 deletions.
Binary file added __pycache__/app.cpython-36.pyc
Binary file not shown.
29 changes: 29 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from flask import Flask , render_template, request, redirect

app = Flask(__name__)

@app.route('/')
def index():
return render_template('index.html')

@app.route('/home')
def home():
fruit=['apple','banana','pear']
return render_template('home.html', fruit=fruit)

@app.route('/login',methods=['POST','GET'])
def login():
error=None
if request.method == 'POST':
if request.form['email'] !='rai@gmail.com' or request.form['password'] !='nsoc':
error='Wrong credentials'
else:
return redirect('/home')
return render_template('login.html',error=error)
return render_template('login.html')



if __name__ == '__main__':
app.jinja_env.globals.update(chr=chr)
app.run(host='0.0.0.0' ,port=8000,debug=True, threaded=True)
9 changes: 9 additions & 0 deletions static/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
body
{
font-size: 50px;
font-family: algerian;
background-image: url('/static/images/bm.jpg') ;
background-repeat: no-repeat;
color: white;

}
Binary file added static/images/bm.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions templates/home.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>Home</title>
<link rel="stylesheet" href="/static/css/style.css">

</head>
<body>
NIE is awesome. I hope my principal reads this.
<ul>
{%set x= 'abcdefghijklmnopqrstuvwxyz'%}
{% for i in x %}
{% print(i) %}
{% endfor %}
</ul>
<ul>
{% for i in fruit %}
<li>
{{i}}
</li>
{% endfor %}
</ul>
<a href="/login"><button type="submit" name="logout_submit">Sign out</button></a>

</body>
</html>
14 changes: 14 additions & 0 deletions templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>
Home
</title>
This is my homepage<br>
<link rel="stylesheet" href="/static/css/style.css">
</head>
<body>
NSoC 5.0<br>I like computers a lot
<a href="/home" target="_blank"><h1>Home</h1></a>
</body>
</html>
19 changes: 19 additions & 0 deletions templates/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<title>login</title>
<link rel="stylesheet" href="/static/css/style.css">

</head>
<body>
<form class="" method="post">
<input type="text" name="email" placeholder="Email">
<input type="password" name="password" placeholder="Password">
<button type="submit" name="login_submit">Sign in</button>
</form>
{% if error %}
{{ error }}
{% endif %}

</body>
</html>
Loading

0 comments on commit ae5862a

Please sign in to comment.