COIMBATORE INSTITUTE OF TECHNOLOGY
COIMBATORE – 641 004.
PYTHON PROJECT
“ ARUSUVAI ”
“A FOOD DELIVERY
WEBSITE”
TEAM MEMBERS:
AANIRUDH.P
DIVAKAR.R
DEEPAVIASH.R
“Arusuvai”
Aim:
To provide an easy-to-use platform for
users to explore and order from a variety of
restaurants.
To enable administrators to manage
restaurant listings, including adding, editing,
and deleting details.
To integrate features like location tracking
and search to enhance user experience.
The user can select his own delivery man
from the available list.
Source Code:
from flask import Flask, render_template, request, redirect, url_for
import mysql.connector
from mysql.connector import Error
import hashlib
import webbrowser
from threading import Timer
app = Flask(__name__)
def hash_password(password):
return hashlib.sha256(password.encode()).hexdigest()
def insert_user(first_name, last_name, contact, email, password, address):
try:
connection = mysql.connector.connect(
host='localhost', # Your MySQL host
database='aani', # Your database name
user='root', # Your MySQL username
password='' # Your MySQL password
)
if connection.is_connected():
cursor = connection.cursor()
# SQL query to insert data
insert_query = """
INSERT INTO user (first_name, last_name, contact, email, password,
address)
VALUES (%s, %s, %s, %s, %s, %s)
"""
cursor.execute(insert_query, (first_name, last_name, contact, email,
hash_password(password), address))
# Commit the transaction
connection.commit()
except Error as e:
print(f"Error: {e}")
finally:
if connection.is_connected():
cursor.close()
connection.close()
@app.route('/')
def home():
return render_template('signup.html')
@app.route('/signup', methods=['POST'])
def signup():
if request.method == 'POST':
# Get form data
first_name = request.form['name']
last_name = request.form['lname']
contact = request.form['contact']
email = request.form['email']
password = request.form['password']
address = request.form['address']
insert_user(first_name, last_name, contact, email, password, address)
return redirect(url_for('login'))
@app.route('/login')
def login():
return render_template('login.html')
def open_browser():
webbrowser.open_new('http://127.0.0.1:5000/')
if __name__ == '__main__':
Timer(1, open_browser).start()
app.run()
CONCLUSION:
This food website successfully meets its objective of
providing a convenient and engaging platform for users to
browse and order food from local restaurants.
With dynamic features such as restaurant management for
administrators, location tracking, and a user-friendly
interface, the website enhances the food ordering
experience.