from flask import Flask, render_template, request, session, url_for, redirect from appdef import app import main, login, logout import pymysql.cursors from datetime import timedelta import os # generate a random secret key for the app app.secret_key = os.urandom(24) @app.before_request def make_session_permanent(): session.permanent = True app.permanent_session_lifetime = timedelta(minutes=5) if __name__ == "__main__": app.run('localhost', 5000, debug = True, ssl_context=('localhost.crt', 'localhost.key'))
from appdef import app import get, post if __name__ == '__main__': app.run(host='0.0.0.0', port=9000, debug=True)
insert(C["cookie_emplid"].value, C["cookie_urgency"].value, C["cookie_idea"].value, C["cookie_why"].value, trackingNo['ticket_id']) # slack integration channel_id = findDept(dept["department"]) # find person name cursor_five = conn.cursor() emp_query = "SELECT employee_name FROM Employee WHERE EMPLID ='" + C[ "cookie_emplid"].value + "'" cursor_five.execute(emp_query) emp_name = cursor_five.fetchone() cursor_five.close() # sending message to slack send_message(channel_id, "Department " + channel_id, C["cookie_emplid"].value, int(C["cookie_urgency"].value), emp_name["employee_name"], C["cookie_idea"].value, C["cookie_why"].value) resp.message(resp_message) return str(resp) if __name__ == "__main__": #app.secret_key = os.environ["SECRET_KEY"] app.secret_key = "WATEVER" app.run('localhost', 5000)
import publicinfo import customer import agent import staff import purchase # Understanding Flask static: http://stackoverflow.com/a/28208187 # app = Flask(__name__) #Define a route to hello function @app.route('/') def hello(): return render_template('index.html') @app.route('/logout') def logout(): session.pop('username') return redirect('/login') # Why secret_key? http://stackoverflow.com/a/22463969 app.secret_key = 'S4p9Z#Z3vjw!@J66' #Run the app on localhost port 5000 #debug = True -> you don't have to restart flask #for changes to go through, TURN OFF FOR PRODUCTION if __name__ == "__main__": app.run('127.0.0.1', 5000, debug=True)
from flask import Flask, render_template, request, session, url_for, redirect import pymysql.cursors from appdef import app, conn import register import login #Define a route to hello function @app.route('/') def index(): return render_template('index.html') @app.route('/logout') def logout(): session.pop('username') return redirect('/login') # Why secret_key? http://stackoverflow.com/a/22463969 app.secret_key = 'S4p9Z#Z3vjw!@J66' #Run the app on localhost port 5000 #debug = True -> you don't have to restart flask #for changes to go through, TURN OFF FOR PRODUCTION if __name__ == "__main__": app.run('127.0.0.1', 5555, debug=True)
import os import main, slack from flask import Flask, render_template from appdef import app, conn SECRET_KEY = os.environ['SECRET_KEY'] if __name__ == "__main__": app.secret_key = SECRET_KEY app.run('localhost', 5000, debug=True)