Finally, I solved the problem myself by coincidence.
The problem is that I also use flask-whooshalchemy
for search feature and the whoosh need to write on the index file.
When running debug mode, the index file is created with ownership of current user, but when deploy the production mode, the user is www-data
(with nginx in Ubuntu) so it have no permission to write.
The key point of finding this problem is to use try except and return the message of the exception as the return of views. Without this, we can not see any trackback or something like that in production deployment.