Forums

Your webapp took a long time to reload..

Hi,

I am getting this error when trying to reload after saving the script:

'Your webapp took a long time to reload. It probably reloaded, but we were unable to check it.'

This is happening only when a function of my webapp is run within an API call, and it works fine when run outside.

That means:

app = Flask(__name__)
myfunction_result = myfunction("/home/qolkoj/img1.jpg")
@app.route('/')
def run_call():
    return myfunction_result

Works fine and I can get the result (myfunction_result) when calling the URL.

Now this doesn't work:

app = Flask(__name__)
@app.route('/')
def run_call():
    myfunction_result = myfunction("/home/qolkoj/img1.jpg")
    return myfunction_result

The reload button takes forever and ends with the error above. The URL doesn't work either so it didn't reload. There are also no new messages in the error log or server log.

hi there- have you checked your most recent error log message- it should be at the bottom of the file.

Nothing logged in the error file.

Now the server just hangs forever when running the function within a call. After a long time, it returns Error code: 504-backend. The exact same function runs fine when run outside the function called.

Could we look into your files? We can but we ask first.

Ok it seems the problem is solved with a combination of reloading the webapp and making sure the function is not called a first time in the environment but only within the route call one time.

Still puzzled by the way the servers behave but it's working now, thanks.

Part of your code is executed when we start your web app or you reload it. Then there is a code that gets executed when a request arrives.

Your webapp took a long time to reload

Hello, i'm getting this error when trying to reload and and even when i open my webapp it's loading but never opening ,i tried to run python manage.py check ,to check the error but it's only showing the errors that i was facing before changing settings. error was this: File "/home/Euphrosine/.virtualenvs/mysite-virtualenv/lib/python3.10/site-packages/psycopg2/init.py", line 122, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) django.db.utils.OperationalError: connection to server at "Euphrosine.mysql.pythonanywhere-services.com" (10.0.0.38), port 5432 failed: Connection t imed out Is the server running on that host and accepting TCP/IP connections? but i changed and used mysql database in pythonanywhere

@Euphrosine It look like it works now.