-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.py
38 lines (30 loc) · 1.1 KB
/
index.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from flask import Flask, render_template
import json
app = Flask(__name__)
with open('data.json', 'r') as data:
data = json.load(data)
@app.route('/')
def home():
return render_template('home.html')
@app.route('/<username>')
def landingPage(username):
try:
userData = data[username]
return render_template(
'index.html',
username = username,
profile_pic = userData['profile_pic'],
github = userData['github'],
whatsapp = userData['whatsapp'],
instagram = userData['instagram'],
twitter = userData['twitter'],
spotify = userData['spotify'],
facebook = userData['facebook'],
telegram = userData['telegram'],
linkedin = userData['linkedin'],
soundcloud = userData['soundcloud']
)
except:
return '<h2> Data not submitted in the repository or invalid username! <a href = "https://github.com/abhilashmnair/aboutme">Click here for instructions.</a><h2>'
if __name__ == '__main__':
app.run(threaded = True, debug = True)