def create_app(): app = Flask(__name__) app.config['SECRET_KEY'] = 'ZGCiPZ5cygTxcxv1PMn1j4VCWowpNGHg' app.add_url_rule("/", view_func=view.home) app.add_url_rule("/", methods=["GET", "POST"], view_func=view.signup) app.add_url_rule("/login", methods=["GET", "POST"], view_func=view.login) app.add_url_rule("/logout", methods=["GET"], view_func=view.logout) app.add_url_rule("/profile", methods=["GET", "POST"], view_func=view.profile) app.add_url_rule("/test", view_func=view.test) app.add_url_rule("/<string:username>/books", view_func=view.books) app.add_url_rule("/<string:username>/books/rating/<int:rating_filter>", view_func=view.books) app.add_url_rule("/<string:username>/books/owned/<string:owned_filter>", view_func=view.books) app.add_url_rule( "/<string:username>/books/completed/<string:completion_filter>", view_func=view.books) app.add_url_rule("/<string:username>/movies", view_func=view.movies) app.add_url_rule("/<string:username>/movies/rating/<int:rating_filter>", view_func=view.movies) app.add_url_rule("/<string:username>/movies/owned/<string:owned_filter>", view_func=view.movies) app.add_url_rule( "/<string:username>/movies/completed/<string:completion_filter>", view_func=view.movies) app.add_url_rule("/<string:username>/series", view_func=view.series) app.add_url_rule("/<string:username>/series/rating/<int:rating_filter>", view_func=view.series) app.add_url_rule("/<string:username>/series/owned/<string:owned_filter>", view_func=view.series) app.add_url_rule( "/<string:username>/series/completed/<string:completion_filter>", view_func=view.series) app.add_url_rule("/<string:username>/others", view_func=view.others) app.add_url_rule("/<string:username>/others/rating/<int:rating_filter>", view_func=view.others) app.add_url_rule("/<string:username>/others/owned/<string:owned_filter>", view_func=view.others) app.add_url_rule( "/<string:username>/others/completed/<string:completion_filter>", view_func=view.others) app.add_url_rule("/<string:username>/books", methods=["GET", "POST"], view_func=view.add_book) app.add_url_rule("/<string:username>/movies", methods=["GET", "POST"], view_func=view.add_movie) app.add_url_rule("/<string:username>/series", methods=["GET", "POST"], view_func=view.add_series) app.add_url_rule("/<string:username>/others", methods=["GET", "POST"], view_func=view.add_other) app.add_url_rule("/delete", methods=["POST"], view_func=view.delete) app.add_url_rule("/edit/<int:content_id>", methods=["POST"], view_func=view.edit) extensions.register_type(extensions.UNICODE) extensions.register_type(extensions.UNICODEARRAY) if not onHeroku: os.environ[ "DATABASE_URL"] = "dbname='postgres' user='******' host='localhost' password='******'" initialize(os.environ.get("DATABASE_URL")) db = Database() app.config["db"] = db return app
from queries import * from views.actor import actor from views.movie import movie extensions.register_type(extensions.UNICODE) extensions.register_type(extensions.UNICODEARRAY) app = Flask(__name__) app.register_blueprint(actor, url_prefix="/actors") app.register_blueprint(movie, url_prefix="/movies") HEROKU = True if (not HEROKU): os.environ[ 'DATABASE_URL'] = "dbname='postgres' user='******' host='localhost' password='******'" initialize(os.environ.get('DATABASE_URL')) @app.route("/") def home_page(): return render_template("home_page.html") if __name__ == "__main__": if (not HEROKU): app.run(debug=True) else: app.run()
import queries adds = [] extensions.register_type(extensions.UNICODE) extensions.register_type(extensions.UNICODEARRAY) app = Flask(__name__) app.config['SECRET_KEY'] = '5791628bb0b13ce0c676dfde280ba245' HEROKU = True if (not HEROKU): os.environ[ 'DATABASE_URL'] = "dbname='postgres' user='******' host='localhost' password='******'" initialize(os.environ.get("DATABASE_URL")) @app.route("/appointment/<id>", methods=["GET", "POST"]) def appointment_page(id=0, type=0): active = queries.run("""SELECT current_user""") if active[0][0] == None: active.pop(0) active_num = (len(active)) psychologistt = queries.select("name", "psychologist", asDict=True) patientt = queries.select("name", "patient", asDict=True) total_user = len(psychologistt) + len(patientt) print("W" * 30) print(list(request.form.items())) psychologist = queries.select("id,name,mail", "psychologist", asDict=True) if (request.method == "GET"):