#django

/

      • eb0t
        and maybe might have C++ ..so its like AND & OR
      • jtiai
        eb0t: And thats where search engines do excel.
      • eb0t
        YES
      • so it looks like i need a search engine
      • pete___
        eb0t: Whats the issue with using haystack and elastic search? It's not horribly difficult to setup
      • eb0t
        elasticsearch needs to have java version 9 on the server
      • moldy
        from what you told us so far, a search engine would be overkill
      • and ES would be super-overkill
      • eb0t
        yes haystack i think looks fine...and it doesnt need java 9 on the server
      • moldy
        you can probably solve your task with a simple ArrayField. https://docs.djangoproject.com/en/2.1/ref/contr...
      • pete___
        eb0t: Haystack will still need a search engine, its just an interface between the search engine and django
      • crCr62U0 joined the channel
      • eb0t
        that could be an answer...ill take a look moldy...otherwise i think im going to go the haystack and whoosh route
      • moldy
        last time i checked ES wanted 4gb ram or such to even start
      • mintograde joined the channel
      • jtiai
        hardware is cheap... :)
      • moldy
        not in the cloud ;)
      • it also tends to crash now and then (IME) and it is not so easy to understand
      • eb0t
        the ES solution looks fantastic ...but i think its resource intensive
      • moldy
        i have replaced ES with plain SQL in two projects
      • eb0t
        nice
      • moldy
        there surely are cases where ES makes sense, but this doesn't sound like one to me
      • pete___
        mmm... we use bonsai with heroku, it's free for us at the moment with about 500K objects to search
      • ggj joined the channel
      • it was a bit fiddly to setup but it works really well
      • eb0t
        do you guys not like haystack and whoosh
      • thiras joined the channel
      • moldy
        i don't find that much value in haystack, tbh. whoosh is ok, but so is postgres FTS
      • Oli
        I used it for a bit. Then we moved to pure Postgres full-text when Django implemented it and that was nearly as fast... Well it was Fast Enough™
      • eb0t
        hmmm i am using postgres
      • k_sze[work] has quit
      • moldy
        however, it seems you want to search "tags", not "natural language"
      • i.e. you don't need stemming etc.
      • eb0t
        yes it will be tags
      • pete___
        IIRC Whoosh needs write access to the server? Which heroku doesn't offer
      • moldy
        and you want to search by simple boolean logic, you don't need relevance scoring with TF/IDF etc...
      • jtiai
        eb0t: And only now you say that you search for tags...
      • Oli
        that's correct, pete___
      • eb0t
        sorry when you said tags... i took it to mean i need to search for technical words eg c++ and not like natural language
      • ie sentences and things
      • moldy
        jtiai: they sort of said it earlier, to be fair
      • at least, i read it that way ;)
      • try ArrayField.
      • Ahuj has quit
      • eb0t
        ok, ill look into ArrayField, and failing that haystack and whoosh
      • thanks guys for some ideas
      • pete___
        eb0t: good luck!
      • eb0t
        thanks
      • iiie has quit
      • pete___
        I have a simple import function that will take a spreadsheet of data and create some category objects from it: https://dpaste.de/wWS0#L What should I be unit testing with this function?
      • jtiai
        pete___: I really suggest that you use validation there. Either Form or ModelForm would do fine. (or model validation) And testing is easy, feed known file(s) to it
      • esrse has quit
      • esrse joined the channel
      • EyePulp joined the channel
      • drodger has quit
      • pete___
        jtiai: OK sure, I know I'm going to have to write a form with validation (and some tests for it) at some point but these sheets can be pretty big so I don't want to have to upload them every time right now. Is there anything else I should be testing?
      • jtiai
        "everything". correct data, broken data etc.
      • iiie joined the channel
      • drodger joined the channel
      • esrse has quit
      • kezabelle has quit
      • chasonchaffin joined the channel
      • greg_f joined the channel
      • luxeve joined the channel
      • arthurio joined the channel
      • Ahuj joined the channel
      • randominternetus has quit
      • chasonchaffin has quit
      • sydbarret has quit
      • idontneedanick has quit
      • zanderle joined the channel
      • mintograde has quit
      • zanderle
        Hey folks! I have a question about testing: how could I write a test that checks that a certain decorator has been applied to a view
      • So for example if I have a login_required decorator, how can I test that I applied it to a certain view?
      • Ahuj has quit
      • Or would it be better to just test if it works as expected (decline access to unauth users)?
      • Ahuj joined the channel
      • idontneedanick joined the channel
      • MickeySoFine has quit
      • Combined2857 joined the channel
      • moldy
        zanderle: that
      • zanderle
        moldy: that what? :D
      • moldy
        zanderle: test the behaviour, not wether the decorator is applied
      • Haudegen has quit
      • zanderle
        Yeah I guess so. For some reason I thought that since the decorator is already tested, I should just test if it's been applied
      • Ahuj has quit
      • arthurio has quit
      • arthurio joined the channel
      • BSL joined the channel
      • encod3 joined the channel
      • Combined2857 has quit
      • arthurio has quit
      • luxeve joined the channel
      • zeus1 has quit
      • BSL has quit
      • Ahuj joined the channel
      • drarok joined the channel
      • drarok
        Hi all – I'm having a super weird issue where my session id cookie is expired for some reason, even though it's still valid. Seems to happen after lots of AJAX requests, but I can't find anything that would kill a session after n requests. Any pointers gratefully received.
      • drarok is now known as Drarok
      • markb1 has quit
      • jadajada has quit
      • koniiiik
        Drarok: What exactly do you mean when you write expired? Does the browser stop sending it, or does the server no longer accept it?
      • zeus1 joined the channel
      • Drarok
        The server sends a setcookie sessionid=, Expiry=1970
      • But if I put that same sessionid back into my browser, it's valid and I'm logged in again.
      • moldy
        Drarok: but it sends an actual sessionid in that cookie?
      • amcorreia joined the channel
      • Drarok
        No, it literally sets it to empty string when the problem happens. It's extremely intermittent, sometimes it happens over and over again in a few minutes, then it'll stop breaking for ages.
      • jtiai
        It must be something in your system messing with cookies...
      • Drarok
        I'm using redis sessions so it could be that rather than django, but I don't know where to start looking to confirm what is causing the session cookie to be erased.
      • jtiai
        Redis entries do have max lifetime if set.
      • koniiiik
        I doubt it's the session backend, since, as you say, setting the cookie manually restores the original session.
      • Sounds more like something between your application, and the browser is doing stuff.
      • Ahuj has quit
      • Drarok
        It only seems to happen in dev, too. The data's in redis, but I wondered if maybe when django is asking the session backend for the data it's getting an error, swallowing that error, and assuming the session is dead.
      • And since I'm in dev using runserver, there's nothing between my browser and the app.
      • jtiai
        Have you set session lifetime different from the default?
      • moldy
        Drarok: empty string and expiry=1970 means something is telling the browser to discard the cookie, i think
      • koniiiik
        You could set a breakpoint (or log the stack) in HttpResponse.delete_cookie to see if anything triggers it.
      • Drarok
        koniiiik: that's the insider info I'm after, thanks! If I can view the stack once that's called I might get some clues.
      • chasonchaffin joined the channel
      • theo_moore has quit
      • zeus1 has quit
      • request.session.is_empty() returns true, but there's data in there O_o
      • K-ballo joined the channel
      • jtiai
        Not a django question but where you folks have bought your domain names?
      • dodobas
      • jtiai
        (love the graphics!)
      • dodobas
        it works, and has nice graphics :)
      • chasonchaffin has quit
      • not too expensive :)
      • moldy
        jtiai: inwx.de these days, domainfactory.com before that
      • Oli
        jtiai, gandi.net but only because I get enterprise pricing through Ubuntu Membership
      • moldy
        that might be germany-specific though
      • Oli
        Not that they're bad, their rebilling is a little odd but they're a solid company.
      • zeus1 joined the channel
      • Drarok
        Same, gandi.net for all my personal domains. I think work use them, too.
      • rpkilby joined the channel
      • koniiiik
        Dynadot.
      • Which reminds me, I wanted more domains. :D
      • Ahuj joined the channel
      • For some reason people seem to have trouble dealing with the quadruple i. :P
      • Lcstyle has quit
      • Lcstyle joined the channel
      • sydbarret joined the channel
      • Ahuj has quit
      • Ahuj joined the channel
      • jtiai
        That porkbun looks promising.
      • kiloreux joined the channel
      • eperzhand has quit