Forums

Execute single file from outside

Hi, I'm very new to PythonAnywere: i tried to read various posts here, but I'm not sure if I can do what I should do.

I don't need any Flask or other framework.

I only have a single file: the file contains an import from the sklearn library and a little, not intensive, calculation.

I must be able to call this file from outside, with a request: a script requests this file sending a POST, the file reads the POST content, executes the little calculation and returns a JSON.

That's it.

Is it possible to do this with PythonAnywhere? I'm confused by the tutorial (!) and other resources I found, sorry.

Could you help me understand how to do this?

We have a blog post about how to turn a Python script into a web app: https://blog.pythonanywhere.com/169/

Hi glenn, I haven't found this one, thank you very much!

OK, so Flask is always required

No, but it is the easiest way to get something working.

Hi Glenn. Do you guys by chance have the same blog post but geared towards Django?

I must say I tried locally with Ngrok + Gunicorn and it was a nightmare to parse the JSON without using any framework.

Thanks a lot.

@soulreaper We do not have one yet.