0

Here is my codes. debugcode I am working on buy. And I completed most of the functions. When I go to webServer to test it. I got a fatal error.(because I am debugging the code, so I commented all the core code.) buy As you can see, I can get the buy page correctly. But when I post the request, I got this.(It directly logout.) return It's very strange. I don't know why. And I can't see '666666' in my command console. I think it means that the programme doesn't go into "POST" set. I want to know how to solve that. Thanks!

1 Answer 1

1

And I can't see '666666' in my command console.

Assuming you mean the browser console, that is not where you should be looking. Since application.py is running on the server, any print messages will appear on the server, ie in your flask run terminal, not in the browser console. That output can be quite "noisy"; think about making your debug message stand out more something like print("XXXXXXXXXX>>>>>>YOU ARE HERE<<<<<<XXXXXXXXXX").

This is not the solution to the problem, it is meant to aid your troubleshooting.

What is the "fatal error" you are getting? I don't think it is "directly logout", I think that is a side-effect of the problem.

2
  • Yup, the problem is that even if I put the print sentence under "if request.method == "POST" " I can't see it prints anything. But if I put this sentence under "else:", I can see the sentence. Because of that, I guess the programme doesn't execute POST part.
    – 江泽民
    Commented Apr 14, 2017 at 13:13
  • Okay, thank you very much. I found my mistake. Maybe it's because I am too sleepy(I haven't slept for 20 hours). This problem is in my 'buy.html'. <form action="{{ url_for('login') }}" method="post"> I forgot to modify it. Hum, maybe I should go to sleep. Anyway, Thank you for your help!
    – 江泽民
    Commented Apr 14, 2017 at 13:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .