Python is telling you that you can't apply a decorator to an if statement. Decorators are for callables (functions, classes etc.)
Also PythonAnywhere uses WSGI for web apps, so your if statement will never be entered.
It also seems to me like the AppServer class is only there to set up some config when the app is started. So you'd have to do that outside of the if statement.