Il giorno 07/dic/2012, alle ore 11:42, André Cruz <[email protected]> ha 
scritto:

> Hello.
> 
> I have uWSGI serving a Django application. Everytime a uwsgi worker starts, 
> it seems the Django app is not loaded on the spot. Instead, when the first 
> request arrives, the application springs into action. The problem is that my 
> application connects to a few services when it starts (Cassandra, Zookeeper, 
> etc), and it seems that the first request(s) fail because of this. I get 
> ImportErrors for things that are there. After a few moments everything starts 
> working correctly.
> 
> My question is this, is it possible to trigger this initialization work as 
> soon as the worker is started? This way when the first request arrives 
> everything should be ready to go.
> 
> Thanks!
> André
> 

This is how Django works. The app is really loaded after the first request.

You can "fake" things adding something like that at the end of the wsgi,py file:

application({'SERVER_PROTOCOL':'HTTP/1.0'}, None)

(you could need to add more key to the first argument to simulate a valid first 
request)

--
Roberto De Ioris
http://unbit.it
JID: [email protected]

_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to