I have deployed the successfully running python flask app on pythonanywhere. Only the home page is showing but when I submit the form its throwing Internal Server Error.
What might be the case.Checking the console network ,the requests link I have used is not being visited and error comes ahead.
I have successfully installed requests and BeautifulSoup dependencies for the project in virtualenv.
Here is the code
from flask import Flask,render_template
from flask import request
#lets do the scraping here
import requests
from bs4 import BeautifulSoup
app=Flask(__name__)
@app.route('/',methods=['GET','POST'])
def index():
if request.method== "GET" :
return render_template('home.html',result="")
else:
result=requests.post("jobkhulyo.com/")
soup1=BeautifulSoup(result.content)
return render_template('home.html',result=soup1);
if __name__=="__main__":
app.run(debug=True)
The GET methods is working well but for the POST methods its throwing an internal server Error. Home.html is the template file inside template directory. Same template is loaded in POST method but with some values when Form is submitted.