Hi, I have a webapp running on Flask backend. I have the JS files and functions. The entire website runs fine on my local machine. The site even compiles on PythonAnywhere, but I get a set of errors at each request I make -
For eg - I have a button which loads the structure of a protein when clicked, this works fine on my local machine. But on PythonAnywhere, I get the following error - POST https://drugprotai.pythonanywhere.com/fetch_pdb 404 (NOT FOUND) script.js:153 Error fetching PDB file: SyntaxError: Unexpected token '<', "<!doctype "... is not valid JSON
My js function is -
fetch('/fetch_pdb', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ uniprot_id: uniprotId }) }) .then(response => response.json()) .then(data => { ....
and the corresponding call to the Flask app is -
@app.route('/fetch_pdb', methods=['POST']) def fetch_and_display_structure(): data = request.json uniprot_id = data.get('uniprot_id') .....