Recently I've been practicing to build a website with flask. Now i encounter a problem.
There is a function which to achieve registration. The code like this:
def register():
...
some judgment
...
if true:
sendmail()
return redirect(url_for('onepage'))
My question is :
When preforming sendmail(), it needs much time. So the users have to wait for a moment to get "onepage", about 4-5s. This will bring a bad experience. I know that using threading can let these two functions independently of each other, but I have learnt programming for a very short time so I have no experience in threading programming, Could anybody provide some ideas or code examples for me at this problem?