A
A
a_well2014-02-16 22:56:01
Python
a_well, 2014-02-16 22:56:01

How does uwsgi work for python and Django\tornado specifically?

Good afternoon!
Trying to speed up the site in python, I started looking for different frameworks and decided to try the tornado+sqlalcemy+wheezy.template bundle.
As a result, I set the output of messages to the moments of initialization of the session and the template engine and realized that for each client this initialization occurs anew, sqlalchemy connects to the database again, wheezy compiles the templates again.
Question: is it possible to run the application until a certain point, that is, I have pre-initialization and then the application processes all requests from some point without re-initializing?
There are suspicions that this is how uwsgi works, well, or something similar, but I did not find a description of the normal one.
I would be glad for any information!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
a_well, 2014-02-18
@a_well

Decided to find out myself.
As a result, a simple option:
uwsgi starts up, initializes a script/application instance and waits for a request.
When a request is received, it is sent to a function that takes two
environ parameters and a start_response callback function.
This is if in general terms.
A tornado allows you to initialize all systems earlier and then process requests.

K
kenny_opennix, 2014-02-17
@kenny_opennix

nginx with the uwsgi module solves the problem. Uwsgi is an implementation of wsgi.

A
Alexander Sharomet, 2015-04-25
@sharomet

You leave the first frame empty in the movie, and by pressing gotoandstop on the second frame in which your photo is.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question