view_func=Main.as_view('main'), methods=['GET']) app.add_url_rule('/login/', view_func=Login.as_view('login'), methods=['GET', 'POST']) app.add_url_rule('/remote/', view_func=Remote.as_view('remote'), methods=['GET', 'POST']) app.add_url_rule('/music/', view_func=Music.as_view('music'), methods=['GET']) app.add_url_rule('/show-users/', view_func=Show_users.as_view('show_users'), methods=['GET']) app.add_url_rule('/register/', view_func=Register.as_view('register'), methods=['GET', 'POST']) app.add_url_rule('/account-settings/', view_func=Account_settings.as_view('account_settings'), methods=['GET']) app.add_url_rule('/account-settings/change-password/', view_func=Change_password.as_view('change_password'), methods=['GET', 'POST']) @app.errorhandler(404) def page_not_found(error): return flask.render_template('404.html'), 404 app.debug = True app.run()
from login import Login from register import Register from music_library import MusicLibrary app = flask.Flask(__name__) app.secret_key = "most_secretKey_ever" app.config["UPLOAD_FOLDER"] = "static/music" app.config["MAX_CONTENT_PATH"] = 16 * 1024 * 1024 app.add_url_rule("/", view_func=Main.as_view("main"), methods=["GET"]) app.add_url_rule("/<page>/", view_func=Main.as_view("page"), methods=["GET"]) app.add_url_rule("/login/", view_func=Login.as_view("login"), methods=["GET", "POST"]) app.add_url_rule("/register/", view_func=Register.as_view("register"), methods=["GET", "POST"]) app.add_url_rule("/music_library/", view_func=MusicLibrary.as_view("music_library"), methods=["GET"]) @app.errorhandler(404) def page_not_found(error): return flask.render_template('404.html'), 404 @app.route("/upload_song/", methods=["POST"]) def upload_song(): f = flask.request.files["file"] path = os.path.join(flask.current_app.root_path,
#Routes app.add_url_rule('/', view_func=Main.as_view('main'), methods=['GET', 'POST']) app.add_url_rule('/<page>/', view_func=Main.as_view('main'), methods=['GET']) app.add_url_rule('/login/', view_func=Login.as_view('login'), methods=['GET', 'POST']) app.add_url_rule('/remote/', view_func=Remote.as_view('remote'), methods=['GET', 'POST']) app.add_url_rule('/music/', view_func=Music.as_view('music'), methods=['GET']) app.add_url_rule('/show-users/', view_func=Show_users.as_view('show_users'), methods=['GET']) app.add_url_rule('/register/', view_func=Register.as_view('register'), methods=['GET', 'POST']) app.add_url_rule('/account-settings/', view_func=Account_settings.as_view('account_settings'), methods=['GET']) app.add_url_rule('/account-settings/change-password/', view_func=Change_password.as_view('change_password'), methods=['GET', 'POST']) @app.errorhandler(404) def page_not_found(error): return flask.render_template('404.html'), 404 app.debug = True