Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1063

Python • Re: Raspberry Pi pill dispenser using servos 30

$
0
0
how to I fix the pill schedule link win I click on it. It says Not Found
The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

Code:

from flask import Flask, render_templateapp = Flask(__name__)# Define sample pill schedulepill_schedule = [    {'name': 'Pill 1', 'time': '8:00 AM'},    {'name': 'Pill 2', 'time': '12:00 PM'},    {'name': 'Pill 3', 'time': '4:00 PM'}]@app.route('/')def index():    return render_template('index.html')@app.route('/view_schedules')def view_schedules():    return render_template('view_schedule.html', pill_schedule=pill_schedule)@app.route('/add_pill')def add_pill():    return render_template('add_pill.html')if __name__ == '__main__':    app.run(debug=True, host='192.168.12.170')

Code:

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <meta name="viewport" content="width=device-width, initial-scale=1.0">    <title>Pill Schedule</title></head><body>    <h1>Pill Schedule</h1>    <table>        <thead>            <tr>                <th>Pill Name</th>                <th>Schedule Time</th>            </tr>        </thead>        <tbody>            {% for pill in pill_schedule %}            <tr>                <td>{{ pill.name }}</td>                <td>{{ pill.time }}</td>            </tr>            {% endfor %}        </tbody>    </table>    <p><a href="/add_pill">Add Pill</a></p>    <p><a href="/">Back to Home</a></p></body></html>

Statistics: Posted by bob5731 — Wed Mar 27, 2024 11:15 pm



Viewing all articles
Browse latest Browse all 1063

Latest Images

Trending Articles





Latest Images