-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
45 lines (39 loc) · 1.26 KB
/
app.py
File metadata and controls
45 lines (39 loc) · 1.26 KB
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
39
40
41
42
43
44
45
from operator import contains
from flask import Flask
from flask import render_template
from flask import request
app = Flask(__name__)
@app.route('/')
def index():
ua = request.headers.get('User-Agent')
print(ua)
if 'mobile' in ua or 'Mobile' in ua:
return render_template('mobile/home.html', curr_page='Home')
else:
return render_template('home.html', curr_page='Home')
@app.route('/recipes')
def recipes():
ua = request.headers.get('User-Agent')
print(ua)
if 'mobile' in ua or 'Mobile' in ua:
return render_template('mobile/recipes.html', curr_page='Recipes')
else:
return render_template('recipes.html', curr_page='Recipes')
@app.route('/stuff')
def stuff():
ua = request.headers.get('User-Agent')
print(ua)
if 'mobile' in ua or 'Mobile' in ua:
return render_template('mobile/stuff.html', curr_page='Stuff')
else:
return render_template('stuff.html', curr_page='Stuff')
@app.route('/about')
def about():
ua = request.headers.get('User-Agent')
print(ua)
if 'mobile' in ua or 'Mobile' in ua:
return render_template('mobile/about.html', curr_page='About')
else:
return render_template('about.html', curr_page='About')
if __name__ == '__main__':
app.run()