from hotel import app if __name__ =="__main__": app.run(debug=True)
import sys import os from hotel import app as application sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) os.environ.setdefault('FLASK_SETTINGS_MODULE', 'hotel.settings.prod') application.config.from_object(os.environ['FLASK_SETTINGS_MODULE']) if application.config['DEBUG']: application.run(port=8000, debug=True) else: application.run(host='0.0.0.0', port=80)
cost_daily = 0 for each in booked_room_list: each_room_id = each.room_id for e in room_list: if each_room_id == e.room_number: cost_daily += e.cost cur_res = Reservations.query.get(rid) checkin = cur_res.checkin_date checkout = cur_res.checkout_date dateRange = (checkout - checkin).days total_cost = cost_daily * dateRange return total_cost @app.route('/payment/<rid>', methods=['GET', 'POST']) def payment(rid): if session['user_available']: payment = PaymentForm(request.form) us = User.query.filter_by(username=session['current_user']).first() if request.method == "POST": pd = Payment(us.uid, rid, payment.cardname.data, payment.cardnumber.data, "Confirmed") db.session.add(pd) db.session.commit() return redirect(url_for('show_rooms')) return render_template('payment.html', payment=payment) if __name__ == '__main__': app.run()
from hotel import app if __name__ == "__main__": app.run(port=5001, debug=True)