Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

306
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!