Forums

How to test run a Flask app

Often times I'd like to test additions to my Flask app before going live with the changes. Is there a way to do something like

python flask_app.py --test new_feature

and this process would start my flask_app and attempt to load mypythonanywhere.com/new_feature

I'm not entirely sure what you're trying to accomplish, but perhaps you can use unit tests. Flask has docs on testing Flask apps

I have the same question . Someone suggest a workaround .

A workaround for what? What, exactly are you trying to accomplish?

I would find it really useful to if there were a test environment(much like pypi test) where changes could be temporarily uploaded prior to 'real' deployment. The benefits would be simply to test an app to see if everything in deployment works as it does on the local server - theoretically it should but this has not been my experience so far.

See this discussion. You could do that with cwelsh2.pythonanywhere.com and your own custom domain, or you could even have a testing.yourdomain.com as well.

Thanks, this approach would work nicely. Since I'm new to this can I just double check - am I right in thinking that if I want another domain I need to pay for one separetly?

Thanks, this approach would work nicely. Since I'm new to this can I just double check - am I right in thinking that if I want another domain I need to pay for one separetly?

that's right. you can add extra webapps to your plan at any time by going to "customize" on the accounts page...