Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

302
Visualizações
Error al cargar el recurso: el servidor respondió con un estado de 404 (NO ENCONTRADO) np4A8.png:1

Tengo dos archivos para hacer una página CAPTCHA, aquí está el archivo HTML

 <!DOCTYPE HTML> <html> <head> <title> Example </title> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> <link rel="shortcut icon" href="#"> </head> <body onload="example()"> <h1> Captcha Example </h1> <div id="x"></div> <label> Enter the text from Captcha above </label> <input type="text" id="CaptchaInput"> <br> <br> <input type="button" value="Enter" id="Button"> <script> var Captcha ='{{ newData.CaptchaValue }}'; Button.addEventListener("click", function() { if(Input === Captcha) { console.log("Match"); } else { console.log("Incorrect"); } }) function example () { $.ajax({ url: "/", context: document.body }) var img1 = new Image(); img1.src = "../np4A8.png"; } </script> </body> </html>

Y mi archivo Python

 import random from flask import Flask, render_template from captcha.image import ImageCaptcha app = Flask(__name__) result_str = ''.join( (random.choice('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') for i in range(5))) @app.route('/') def generateCaptcha(): # Create an image instance of the given size image = ImageCaptcha(width=280, height=90) # Image captcha text will equal random result captcha_text = result_str # generate the image of the given text data = image.generate(captcha_text) # write the image on the given file and save it image.write(captcha_text, result_str + '.png') newData = {'CaptchaValue': result_str} return render_template('main.html', newData=newData) if __name__ == "__main__": app.run(debug=True)

Siempre recibo el error: Error al cargar el recurso: el servidor respondió con un estado de 404 (NO ENCONTRADO) np4A8.png:1 Necesito cambiarlo por el nombre del archivo captcha pero primero quería trabajar con una imagen que ya existe . Básicamente tengo el directorio principal y una carpeta de plantillas con mi página HTML. La carpeta del directorio principal tiene las imágenes PNG. Pensé que "../np4A8.png" era el directorio anterior y buscaba una foto llamada np4A8.png. Por favor, ayúdame. Estoy tan cerca de terminar y he estado luchando con esto

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda