-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
87 lines (67 loc) · 2.76 KB
/
app.py
File metadata and controls
87 lines (67 loc) · 2.76 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
from flask import Flask, render_template, send_from_directory, request, redirect, url_for
import os
app = Flask(__name__, template_folder='.')
STATIC_DIR = os.path.abspath(os.path.dirname(__file__))
@app.route('/')
def home():
"""Renders the main landing page (index.html)."""
return render_template('index.html')
@app.route('/login_signup.html')
def login_signup():
"""Renders the login/signup role selection page."""
return render_template('login_signup.html')
@app.route('/user_login.html')
def user_login():
"""Renders the user login page."""
return render_template('user_login.html')
@app.route('/user_signup.html')
def user_signup():
"""Renders the user signup page."""
return render_template('user_signup.html')
@app.route('/farmer_login.html')
def farmer_login():
"""Renders the farmer login page."""
return render_template('farmer_login.html')
@app.route('/farmer_signup.html')
def farmer_signup():
"""Renders the farmer signup page."""
return render_template('farmer_signup.html')
@app.route('/u_homepage.html')
def u_homepage():
"""Renders the user homepage."""
return render_template('u_homepage.html')
@app.route('/f_homepage.html')
def f_homepage():
"""Renders the farmer homepage."""
return render_template('f_homepage.html')
@app.route('/home.html')
def main_home():
"""Renders the secondary home page (same as u_homepage.html)."""
return render_template('home.html')
@app.route('/gps.html')
def gps_page():
"""Renders the GPS page that uses the JavaScript file."""
return render_template('gps.html')
# ==============================================================================
# --- Static File Routes ---
# These routes are necessary to serve the CSS, JS, and image files.
# The browser will request these files based on the paths in your HTML.
# ==============================================================================
@app.route('/style.css')
def serve_css():
"""Serves the main stylesheet."""
return send_from_directory(STATIC_DIR, 'style.css')
@app.route('/your_script.js')
def serve_js():
"""Serves the main JavaScript file."""
return send_from_directory(STATIC_DIR, 'your_script.js')
@app.route('/image/<path:filename>')
def serve_image(filename):
"""Serves image files from the 'image' subfolder."""
return send_from_directory(os.path.join(STATIC_DIR, 'image'), filename)
# You can add more routes for other pages mentioned in the navigation,
# such as '/features.html', '/products.html', etc., as you create them.
if __name__ == '__main__':
# Run the application in debug mode.
# The debug=True flag automatically reloads the server on code changes.
app.run(debug=True)