#django

/

      • saransh__
        how ?
      • pjotr
        apollo13: thanks, I will give it a try and test it towards both 1.6 and 1.7 to assure I don't break something...
      • apollo13
        export DJANGO_SETTINGS_MODULE=…
      • saransh__: read the docs on how to configure settings in django
      • saransh__
        apollo13: actually I used it
      • apollo13: after importing django settings
      • DAudioLink has left the channel
      • apollo13
        saransh__: please see the topic
      • tightflks_ has quit
      • saransh__
        apollo13: I am using middleware in scrapy, it can 't access it
      • apollo13
        aha
      • saransh__
        apollo13: so how to fix it ?
      • apollo13
        again, please see the topic
      • ciurkut has quit
      • maryokhin joined the channel
      • maryokhin has left the channel
      • aliteralmind has quit
      • Bryson_ joined the channel
      • saransh__
        apollo13: once I import django settings, on running crawler it is giving an error "Cannot import scrapy settings module he_crawler.settings
      • warnings.warn("Cannot import scrapy settings module %s" % scrapy_module)"
      • apollo13
        aha
      • ryborg has quit
      • saransh__
        do i need to give scrapy settings in django settings file ?
      • deni has left the channel
      • apollo13
        django doesn't know or care about scrapy
      • If scrapy needs settings you have to figure that out by reading the scrapy docs
      • dAnjou
        in fact, django and scrapy should really not be tied together
      • apollo13
        dunno, never used it
      • drag0nius
        is it possible to filter by relations count in m2m field?
      • saransh__
        actually I need it
      • drag0nius
        or as a matter of fact m2m or reverse FK
      • dAnjou
        well, it's 2 tools doing entirely different things
      • aliteralmind joined the channel
      • apollo13
        dAnjou: well I'd imagine someone would want to put the scrapped stuff into a database or so… don't see why using the django orm there wouldn't work
      • r0bby_ is now known as robbyoconnor
      • granted I'd only use it if the website uses django too ;)
      • ArcTanSusan joined the channel
      • saransh__
        apollo13: what my application does is, through scrapy it requests the url and the middleware of that url is called once it's middleware is called, I count the no. of queries running for that url
      • dAnjou
        apollo13: then why don't they rip out the ORM already :P
      • saransh__
        through django.db's connection method
      • is there any other approach I can follow ?
      • apollo13
        dAnjou: well for the start; history... packaging in python is far from easy ;)
      • saransh__: dafuq? what's the purpose for that?
      • dAnjou
        saransh__: if you're not that far yet, switch to sqlalchemy and another web framework ;)
      • apollo13
        dAnjou: I fail to see how that solves any problem, but sure… oO
      • fission6 joined the channel
      • dAnjou
        apollo13: maybe i'm just day dreaming and suggesting things that would actually solve my problems :D
      • apollo13
        haha
      • hypnosb
        I give u
      • up
      • spaghetti code it is
      • dAnjou
        hypnosb: put some meatballs in
      • atlasloewenherz joined the channel
      • saransh__
        dAnjou: can you give me a brief idea of SQLAlchemy ?
      • Symon is now known as Symon|away
      • apollo13
        lol
      • dAnjou
        saransh__: it's an ORM
      • drag0nius
        just in case, found solution with aggregations ( .annotate().filter()
      • saransh__
        dAnjou: I never used it and how can I do this thing by it ?
      • theslow1
        apollo13: I guess it was magical accident I was inserting new fields. The proper method is cleaner :)
      • dAnjou
        saransh__: sorry, forget that i ever said something ;)
      • apollo13
        dAnjou: oh cmon, now you gotta help or wasn't it such a good idea after all :þ
      • saransh__
        dAnjou: I don't get it ?
      • aliteralmind has quit
      • scriptThis joined the channel
      • amizya joined the channel
      • bradfordtoney joined the channel
      • naro_ joined the channel
      • TodPunk joined the channel
      • atlasloewenherz has quit
      • dAnjou
        saransh__: i didn't fully understand what you were talking about and saw a problem that probably wasn't there. so I suggested something rather drastic instead of figuring out what your real issue is.
      • apollo13
        seriously: lol
      • dAnjou
        and apollo13 called me out on it
      • saransh__
        haha!
      • shall I explain it again?
      • apollo13
        saransh__: btw, please don't tell me you are trying to use scrapy to test how many queries your site executes
      • dAnjou
        saransh__: not to me, i'm braindead. had quite a day.
      • pjotr
        apollo13: worked on both 1.6 and 1.7, thanks for the great tip. Is there any version >=1.4 that it will fail for?
      • princearora has quit
      • apollo13
        pjotr: should work from 0.96 onwards
      • pjotr
        apollo13: thanks
      • viper0984 joined the channel
      • dAnjou
        btw. let me share another piece of quality code that i found in our django project today: https://dpaste.de/WOEC
      • abe_music joined the channel
      • (slightly modified for readability)
      • apollo13
        dAnjou: I hope you are not blaming the Django ORM for that too ;)
      • dAnjou
        nope
      • thanks to git blame i know exactly who to .. blame
      • flowerhack has quit
      • apollo13
        but that's indeed some nice piece of code which could only be nicer if it was written in one line :þ
      • tightflks_ joined the channel
      • was (s)he a java programmer first?
      • dAnjou
        exactly my thoughts!
      • i don't know for sure
      • saransh__ has quit
      • naro_ has quit
      • there are other hints in the codebase which suggest that
      • helderco has quit
      • kenbolton has quit
      • rohitvarkey has quit
      • he left the company long ago
      • apollo13
        wonder why
      • saransh__ joined the channel
      • the code looks pretty save to me, not much margin for errors there
      • dAnjou
        apollo13: but would you consider the pythonic one liner for this less readable?
      • apollo13
        dAnjou: no, on the contrarary
      • something = request.GET.get() == 'bla' is as clean as it will get, I was mostly beeing joking
      • dAnjou
        k :)
      • apollo13
        you should know me better than that
      • amizya has quit
      • dAnjou
        i do actually, that's why i was confused
      • "some nice piece of code which could only be nicer"
      • drag0nius has quit
      • the first nice here is clearly ironic
      • so i thought the second one is too
      • apollo13
        I used ":þ" at the end ;)
      • hypnosb
        whoever wrote this app, has if environment ='' all over the fucking place
      • dAnjou
        anyway, i cringe quite hard on some days :/
      • apollo13
        just remember that it could be worse, eg like hypnosb appears to be having
      • theseb
        anyone ever ran django on google appengine?
      • Maior
        theseb: yes
      • hypnosb
        ._.
      • kenbolton joined the channel
      • busla joined the channel
      • mihow has quit
      • theseb
        Maior: i'm used to running appengine stuff with "dev_appserver.py APP-NAME" but django has its own way to do things.... ./manage.py runserver
      • Maior: the dev_appserver.py way doesn't work w/ django right?
      • georgeirwin has quit
      • saransh__ has quit
      • rhymes joined the channel
      • Maior
      • tightflks_ has quit
      • matthiaswahl joined the channel
      • Nopik joined the channel
      • busla has quit
      • Nopik
        hi all, django newbie here.. I'm about to create hello world kind of application to try out angular. What is the best option to serve json requests from django? I've googled out TastyPie and Django REST framework, any other suggestions?
      • PantsOfChoco
        anyone have a good geodjango database for city boundaries? natural earth is good for countries and states/whatever foreigners call em.
      • Maior
        Nopik: JSONResponse?
      • mihow joined the channel
      • tbaxter
        Maior: that’s way too simple
      • Moar packagez!
      • Nopik
        Maior: if that is an question, I'm afraid I wont have and answer ;)
      • *an
      • Maior
        Nopik: heh no, more of a "this may do what you want"
      • saransh__ joined the channel
      • kenkeiter has quit
      • Nopik
        Maior: ;) yes, probably it might be
      • Maior
        (I know little about Angular)
      • tbaxter
        I’ll also never understand why people want to learn django, angular, rest APIs and five other things all at once. Make your hello world app as simple as possible. You can always add complexity.
      • kenkeiter joined the channel