@app.route("/criar", methods=["POST"])
def criar():
nome = request.form["nome"]
categoria = request.form["categoria"]
console = request.form["console"]
jogo = jogo(nome, categoria, console)
lista.append(jogo)
return render_template("lista.html", titulo="jogos", jogos=lista)
erro mostrado no terminal: C:\Users\wudso\PycharmProjects\jogoteca\venv\Scripts\python.exe C:\Users\wudso\PycharmProjects\jogoteca\jogoteca.py
- Serving Flask app 'jogoteca' (lazy loading)
- Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
- Debug mode: off WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
- Running on http://127.0.0.1:5000
Press CTRL+C to quit
[2023-01-06 08:55:44,680] ERROR in app: Exception on /criar [POST]
Traceback (most recent call last):
File "C:\Users\wudso\PycharmProjects\jogoteca\venv\Lib\site-packages\flask\app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\wudso\PycharmProjects\jogoteca\venv\Lib\site-packages\flask\app.py", line 1518, in full_dispatch_request rv = self.handle_user_exception(e)^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wudso\PycharmProjects\jogoteca\venv\Lib\site-packages\flask\app.py", line 1516, in full_dispatch_request rv = self.dispatch_request()^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wudso\PycharmProjects\jogoteca\venv\Lib\site-packages\flask\app.py", line 1502, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wudso\PycharmProjects\jogoteca\jogoteca.py", line 30, in criar jogo = jogo(nome, categoria, console)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'jogo' where it is not associated with a value 127.0.0.1 - - [06/Jan/2023 08:55:44] "POST /criar HTTP/1.1" 500 - [2023-01-06 08:55:56,041] ERROR in app: Exception on /criar [POST] Traceback (most recent call last): File "C:\Users\wudso\PycharmProjects\jogoteca\venv\Lib\site-packages\flask\app.py", line 2073, in wsgi_app response = self.full_dispatch_request()^^^^
File "C:\Users\wudso\PycharmProjects\jogoteca\venv\Lib\site-packages\flask\app.py", line 1518, in full_dispatch_request rv = self.handle_user_exception(e)^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wudso\PycharmProjects\jogoteca\venv\Lib\site-packages\flask\app.py", line 1516, in full_dispatch_request rv = self.dispatch_request()^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wudso\PycharmProjects\jogoteca\venv\Lib\site-packages\flask\app.py", line 1502, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wudso\PycharmProjects\jogoteca\jogoteca.py", line 30, in criar jogo = jogo(nome, categoria, console)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'jogo' where it is not associated with a value 127.0.0.1 - - [06/Jan/2023 08:55:56] "POST /criar HTTP/1.1" 500 - 127.0.0.1 - - [06/Jan/2023 08:56:02] "GET /novo HTTP/1.1" 200 - [2023-01-06 08:56:13,263] ERROR in app: Exception on /criar [POST] Traceback (most recent call last): File "C:\Users\wudso\PycharmProjects\jogoteca\venv\Lib\site-packages\flask\app.py", line 2073, in wsgi_app response = self.full_dispatch_request()^^^^
File "C:\Users\wudso\PycharmProjects\jogoteca\venv\Lib\site-packages\flask\app.py", line 1518, in full_dispatch_request rv = self.handle_user_exception(e)^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wudso\PycharmProjects\jogoteca\venv\Lib\site-packages\flask\app.py", line 1516, in full_dispatch_request rv = self.dispatch_request()^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wudso\PycharmProjects\jogoteca\venv\Lib\site-packages\flask\app.py", line 1502, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wudso\PycharmProjects\jogoteca\jogoteca.py", line 30, in criar jogo = jogo(nome, categoria, console)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'jogo' where it is not associated with a value 127.0.0.1 - - [06/Jan/2023 08:56:13] "POST /criar HTTP/1.1" 500 -^^^^