These are chat archives for django/django

Jun 2017
Jun 02 2017 00:35
@limdauto you mean a MySQL driver to work with Django ORM?
Luv Agarwal
Jun 02 2017 05:51
Hi guys, I have a Django project in which I have to do some image processing for some particular user requests. So whenever a request comes, it downloads an image using requests.get (in memory), process it and then delete it. Now if the user breaks the connection in between (Broken pipe?), how do I delete this image object? Can I rely on Python garbage collection for this object to be deleted? BTW, I am using Django with mod_wsgi.
Redirect me to the right place if this isn't
Divyang Solanki
Jun 02 2017 06:04
Anyone knows how to make microservices using django ?
Kyle Mulka
Jun 02 2017 06:08
@luvagarwal if the image is in memory, yes, garbage collection should take care of it. but, you said you delete it. how are you doing that?
(that's assuming you aren't doing anything weird where you are keeping a reference to the object around after the request)
@divyangsolanki Sure, you might want to check out the Django REST Framework. Or, if you want to build your own JSON HTTP API, Django has a JsonResponse object to help out.
Divyang Solanki
Jun 02 2017 06:12
@mulka thank you..!!
Kyle Mulka
Jun 02 2017 06:13
If you are posting JSON data to a django view, refer to this stackoverflow to parse the incoming JSON:
Divyang Solanki
Jun 02 2017 06:14
I am making a microservice which performs GET and POST request using json object
Luv Agarwal
Jun 02 2017 06:24
@mulka, I delete the object using del statement.
this should be handled by garbage collector but just to make it explicit
@mulka thanks a lot!!
Jun 02 2017 12:06
'JSESSIONID=5CDB23D21CF5068170BCC2CA7F83757F; Path=/api; Secure'
Simple question "How to extract JSESSIONID"?
My method is very childish. Does anybody know pythonic way?
In [16]: test.split('=')
Out[16]: ['JSESSIONID', '5CDB23D21CF5068170BCC2CA7F83757F; Path', '/api; Secure']

In [17]: first = test.split('=')

In [18]: first[1]
Out[18]: '5CDB23D21CF5068170BCC2CA7F83757F; Path'

In [19]: first[1].split(';')
Out[19]: ['5CDB23D21CF5068170BCC2CA7F83757F', ' Path']

In [20]: second = first[1].split(';')

In [21]: ans = second[0]

In [22]: ans
Out[22]: '5CDB23D21CF5068170BCC2CA7F83757F'
Anish Shrestha
Jun 02 2017 15:40
maybe you could use regex @elcolie
Jun 02 2017 17:54
noob to gitter and django room
Jun 02 2017 19:07
Are there Russian speakers? :)
Jun 02 2017 20:01
@downwriter , welcome.. of you have questions through them in the room here and someone might be able to help