def restart(): # TODO make restart functionality global WORD,gametries,Guess Word = db_instance.models['word'] WORD = WordApi.get_word() print(WORD) GAME_DATA = init_game_data(WORD) Guess = GAME_DATA['GuessLetters'] print(Guess) gametries=GAME_DATA['tries'] print(gametries) print('estoy en restart') return redirect('/') return render_template( 'index.html', instruction1=constants.INSTRUCTION1, instruction2=constants.INSTRUCTION2, instruction3=constants.INSTRUCTION3, game=GAME_DATA,gametries=gametries,letters=letters,final=final)
from hangman import init_game_data import hangman.config.constants as constants import hangman.utils as utils import hangman.validations as validations from config.db import DB from config.api import WordApi app = Flask(__name__) # referencing current file CORS(app) db_instance = DB(app) crud_methods = ['GET', 'POST'] Word = db_instance.models['word'] WORD = WordApi.get_word() print(WORD) GAME_DATA = init_game_data(WORD) #url sin ningún parámetro @app.route('/', methods=crud_methods) def index(): print('estoy en home') global WORD if request.method == 'POST': req = request.form input= utils.word_to_uppercase (req['letter'])