Exception on / [GET] Traceback (most recent call last): File (First Line of Error) sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused(Last Line of Error)
from selenium import webdriver
from flask import Flask, render_template
import random
from pyvirtualdisplay import Display
from selenium.webdriver.firefox.options import Options as FirefoxOptions
app = Flask(__name__)
with Display():
options = FirefoxOptions()
options.add_argument('--headless')
driver = webdriver.Firefox(firefox_options=options)
driver.implicitly_wait(10)
t_file = '/home/parshuram/mysite/static/links'
target = open(t_file).read().splitlines()
try:
@app.route('/')
def get_jokes():
driver.get(random.choice(target))
jokes = driver.find_elements_by_tag_name('p')
mylist = []
for joke in jokes:
mylist.append(joke.text)
return render_template('/home/parshuram/mysite/Template/joke.html', s=mylist)
if __name__ == "__main__":
app.run()
finally:
driver.quit()
It simply says :Internal Error either the application has a fault or the server is overloaded. This is a joke site..so, I don't think it is blocking requests or anything.The app shows no errors in the console, just the usual running at 127.0.0.1 Any ideas?