@mikael unfortunately yes, it seems you need it if the function has the @click.command decorator. Although in this case init_db_command is just a thin wrapper over another function init_db, so you can get around it by just calling init_db directly instead.
Also I think I was wrong that you don't need the environment variable, as well, because I just tried running that code again and it didn't work. I'm guessing I must have had the variable still hanging around from a previous run, so it looked like I didn't need it, but alas. Again though, in this particular case, you can get around it by using init_db and wrapping in the app context. If you're using the command directly though, wrapping with the app context does nothing; you need the environment variable. Hope that makes sense.
@dgelessus , oh I can see where it all went wrong now. I pip installed flask-restful, that also installs flask and jinta. I have been able to re-install flask-restful and delete the folders in the site-packages and have it working now. Thanks again.
@dgelessus , thanks so much. Took the debug out and it works. But I am almost sure that it used to work. Maybe I am wrong.
But really, thank you. It's great it's working.
I finally got PythonAnywhere working today the way I want. I just had to watch a video :). here I just have the basic todo list example from the docs working. But I finally figured out how to install and configure a virtualenv there.