3 ms·
Kind of unrelated to the topic.. but I recently checked out Django for the first time ever recently (I know, 5 years late) - and was impressed. It has a lot of
by brianwawok 11y ago
Kind of unrelated to the topic.. but I recently checked out Django for the first time ever recently (I know, 5 years late) - and was impressed. It has a lot of the things I like in web development with mostly sane defaults (most insane thing found so far: Closing database connection after each request, really?). Edit - Yes I know you can change config to keep connection open, but as a default for prod mode it seemed rather weird ;)
Still fighting the internal battle that I know I like better compile time checking (ala Scala), but having changes happen so fast in dev is pretty freakin nice...
- wahnfrieden 11y agoNot sure what you saw - look into Django connection pooling.
- neokya 11y agoNo, that's fixed since 1.6 release. You can keep database connection persistent, just change the default setting https://docs.djangoproject.com/en/dev/ref/settings/#conn-max-age https://docs.djangoproject.com/en/dev/ref/settings/#conn-max... By default, it uses historical behavior.
- piquadrat 11y agoJust for reference, Django has had support for persistent connections for quite a while now. It's disabled by default due to backwards compatibility considerations. https://docs.djangoproject.com/en/1.9/ref/databases/#persistent-connections https://docs.djangoproject.com/en/1.9/ref/databases/#persist...
- brianwawok 11y agoOh I know, I was talking about sane "defaults".. i.e. if you don't touch the config, the default seems silly. Makes sense to close it in dev, but in default prod? Not sane.
- piquadrat 11y agoI figured you were aware of the feature itself. I just wanted to clarify for people unfamiliar with Django that it does support persistent connections, even if they are disabled by default :)
- Scarblac 11y agoI'm not sure if this is in fact what you're saying, but the closing the database connection each time is only the default (historical reasons), changing it is a matter of changing one setting: https://docs.djangoproject.com/en/1.9/ref/databases/#connection-management https://docs.djangoproject.com/en/1.9/ref/databases/#connect...
- bluetech 11y agoThis is still a similar problem for the memcached cache backend (which django recommends): https://code.djangoproject.com/ticket/11331 https://code.djangoproject.com/ticket/11331
- brianwawok 11y agoOh interesting. I did not mess with memcached, just django + gunicorn + nginx... was pretty nice performance for simple webappy stuff.