Στις Παρασκευή, 9 Ιουλίου 2021 στις 3:57:11 μ.μ. UTC+3, ο χρήστης Menno Holscher έγραψε: > Op 09-07-2021 om 08:14 schreef vergos....@gmail.com: > > Στις Παρασκευή, 9 Ιουλίου 2021 στις 12:03:00 π.μ. UTC+3, ο χρήστης Menno > > Holscher έγραψε: > >> Op 08-07-2021 om 15:42 schreef vergos....@gmail.com: > >>>>> import flask > >>>>> dir(flask) > >> ['Blueprint', 'Config', 'Flask', 'Markup', 'Request', 'Response', > >> 'Session', '__builtins__', '__cached__', '__doc__', '__file__', > >> '__loader__', '__name__', '__package__', '__path__', '__spec__', > >> '__version__', '_app_ctx_stack', '_compat', '_request_ctx_stack', > >> 'abort', 'after_this_request', 'app', 'appcontext_popped', > >> 'appcontext_pushed', 'appcontext_tearing_down', > >> 'before_render_template', 'blueprints', 'cli', 'config', > >> 'copy_current_request_context', 'ctx', 'current_app', 'escape', 'flash', > >> 'g', 'get_flashed_messages', 'get_template_attribute', 'globals', > >> 'got_request_exception', 'has_app_context', 'has_request_context', > >> 'helpers', 'json', 'json_available', 'jsonify', 'make_response', > >> 'message_flashed', 'redirect', 'render_template', > >> 'render_template_string', 'request', 'request_finished', > >> 'request_started', 'request_tearing_down', 'safe_join', 'send_file', > >> 'send_from_directory', 'session', 'sessions', 'signals', > >> 'signals_available', 'stream_with_context', 'template_rendered', > >> 'templating', 'url_for', 'wrappers'] > >> ... there is no "run" there. What were you trying to achieve? > >> > When you look at the exported symbols, there is no route, so if you > expected flask to export route it is not there either. > > How is that even possible? > > > > Do i have something wrong in the www.py? > > > > from flask import Flask, route, request, redirect, render_template, > > url_for, send_from_directory, debug > > > > app = Flask(__name__) > > app.run(debug=True) > There is 2 possibilities here. One is you have a module named route. > Than you do not import it as a name from flask, but as a module. > > The other is you are looking for the attribute route from the Flask class. > > @app.route("/item/<item_no>", methods=["GET", "POST"]) > > This creates a route. The route method is a method of an instance of > Flask (i.e. app), so importing Flask is enough. > > > > Also i use run for this > > > > app.run( host='superhost.gr', port=5000, debug=True ) > > > Yes, that is OK, if DNS contains a host superhost.gr. > -- > Met vriendelijke groet / Kind regards > > Menno Hölscher please tell me what i need to do to be able to see error messages in browser and not only via console:
app = Flask(__name__) app.debug = True application = app The above only displays error via console into the error_log, having to open it each time. how can i see it in browser? -- https://mail.python.org/mailman/listinfo/python-list