print deletedItem.title+" cannot be deleted - wrong user!" return redirect(url_for('listCategoryItems', category_id=category_id)) if request.method == 'POST': if 'Delete' in request.form: session.delete(deletedItem) session.commit() print "category item "+deletedItem.title+" deleted!" return redirect(url_for('listCategoryItems', category_id=category_id)) else: return render_template('categoryItemDelete.html', item=deletedItem) else: return redirect(url_for('listCategoryItems', category_id=category_id)) ########################################################################## # start webserver if __name__ == '__main__': # port = 8000 # print "Web Server running on port %s" % port # app.debug = True app.secret_key = 'super_secret_key' app.config['SESSION_TYPE'] = 'filesystem' sess.init_app(app) #app.run(host='0.0.0.0', port=8000) app.run()
from login import app if __name__ == '__main__': app.run(debug=True)
return redirect(next_page) if next_page else redirect( url_for('all_donation')) else: flash(f'Login Unsuccessful, Please check username and password', 'danger') return render_template('login.jinja2', title='login', form=form) return render_template('login.jinja2', title='login', form=form) @app.route('/single_user', methods=['POST', 'GET']) def single_user(): form = SingleUserForm() if form.validate_on_submit(): username = Donor.select().where(Donor.name == form.name.data) if username: return redirect(url_for('all_donation', user=form.name.data)) else: flash(f'User does not exist!', 'danger') return render_template('single.jinja2', tittle='single_user', form=form) @app.route('/logout') def logout(): logout_user() return redirect(url_for('all_donation')) if __name__ == "__main__": port = int(os.environ.get("PORT", 5000)) app.run(host='0.0.0.0', port=port, debug=True)
#! Code/bin/python from login import app # if __name__ == "__main__": app.run(debug=True)
def main(): url = 'https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.917329664,151.225332432&radius=50000&type=restaurant&key={0}'.format( mykey) res = req.get(url) respond = json.loads(res.content) data = {} data['UNSW'] = {'category': 'resturant', 'results': respond['results']} write_to_json_file(LOCATION_DATA, data) #respond = json.dumps(respond, indent=4) #print(respond['results']) #print(type(respond)) #print(respond) if __name__ == '__main__': app.run(debug=True, port=8080) ''' default user detail ''' User = {} User['gary'] = { "name": 'gary', "password": '******', "email": "1234@gmail", "bank": {}, "timetable": {} } #write_to_json_file(FILE, User)
from login import app if __name__ == '__main__': app.run(debug=True, host='0.0.0.0')
from login import app import socket DEBUG = False LOCAL_NETWORK = True if __name__ == "__main__": if LOCAL_NETWORK: ip = socket.gethostbyname(socket.gethostname()) app.run(host=ip, port=5000, debug=DEBUG) else: app.run(debug=DEBUG)