简体   繁体   中英

flask with uwsgi nginx gateway timeout

I have set up a flask application to use uwsgi and nginx

I used the tutorials on the internet but I have the following issue

I have the following functions on the controller.py file

api_module = Blueprint('cassandra_api', __name__, url_prefix="/api")

@api_module.route('/', methods=['GET', 'POST'])
def home():
    return "c"

the above works great when trying

myip/api/

but the following doesn't work at all

@api_module.route("/fault_prone_snippets/", methods=['GET'])
def get_fault_prone_snippets():
    #code to connect with cassandra db and retrieve get parameters

When I visit

myip/api/faut_prone_snippets/ 

with or without get parameters, no code is executed, I don't see an error message and after the minute is over I get a gateway timeout. The problem is that when I run my flask from localhost it works great. Trying to use cassandra driver from the python console on my dev environment works too and connects with no error. How can I debug this kind of setup when it works locally but not in production?

As you're running behind nginx it might be that setting the keep_alive timeout in the http section of your nginx.conf will help. And/or proxy_send_timeout , proxy_read_timeout parameters in the location section.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM