#django

/

      • codergonebad joined the channel
      • dodobas
        yelloo
      • Kayra has quit
      • pgcd
        FunkyBob: the way i described =) reverse() returns something like '/myapp/myurl' while the one in the response of a self.app.get() (i'm using WebTest) would be http://localhost:80/myapp/myurl (with the testserver address)
      • atlasloewenherz has quit
      • Kayra joined the channel
      • Kayra has quit
      • Kayra joined the channel
      • FunkyBob
        I don't know what WebTest is... or how self.app.get() generates urls
      • so I still don't know the difference
      • Kayra has quit
      • codergonebad has quit
      • Kayra joined the channel
      • theshit123
        hi, i am trying to do something when saving a object for a model and i dont know if i am doing it correctly or not, in the code i explain what i want to do: http://pastebin.com/33dJGUZ2 , basically i am trying to auto select a related object from other model using datefield but if there is not one for that date i want clone last one for that date and use it, the problem is when there is not anything i
      • need to tell the user he need make the first one.
      • Kayra has quit
      • Kayra joined the channel
      • pgcd
        FunkyBob: it's the same with django testclient, i believe - only the urls become http://testserver/myapp/myurl (self.app.get() is equivalent to self.client.get())
      • (I just checked and I can confirm that that's the case)
      • uffs joined the channel
      • so, as far as I can tell, I can either manipulate the strings to compare them (perhaps prepending the "testserver" address to the reverse()d URL, but I can't find the reference on how to retrieve its address) or I can use resolve(), and I was wondering if there was any best practice
      • freeman_u joined the channel
      • kezabelle
        what aspect of the response are you even testing?
      • dlogs has quit
      • IIRC LiveServer always uses testserver as it's address, FWIW
      • Kayra has quit
      • EyePulp joined the channel
      • pgcd
        kezabelle: in this specific case I'm checking that a url is actually the get_absolute_url of an object
      • marek_sv joined the channel
      • marek_sv has quit
      • Kayra joined the channel
      • really, it's not a major issue (i've done it in the past by removiing the http://localhost:80/ bit, for instance)
      • kushal joined the channel
      • kezabelle
        so you're doing something like self.client.get(obj.get_absolute_url()) …. and then testing what?
      • pgcd
        but perhaps there are other, more standard ways
      • FunkyBob
        you coud use the urlparse lib
      • kezabelle: yeah, that's what I don't get
      • pgcd: what are you trying to compare to what, and why?
      • pgcd
        kezabelle: nope, i'm checking if the link generated in a feed is actually the correct one
      • kezabelle
        do response headers even return the path you requested? can't imagine what the point'd be outside of a redirect
      • Kayra has quit
      • right
      • pgcd
        i'm going through a TDD-style thingy phase
      • and yeah, redirects are another very common scenario
      • Kayra joined the channel
      • kezabelle
        so you want to get the <loc> or whatever the xml element is, and then urlparse it and get the .path out of the namedtuple-ish thing
      • pgcd
        the point is that I *know* that they are the same
      • kezabelle: no, no
      • ideally i'd just like to have a reliable way of getting that http://testserver/ string or http://localhost:80/ string
      • Kayra has quit
      • EyePulp has quit
      • il has quit
      • i really just want to compare two strings, if at all possible =)
      • Kayra joined the channel
      • FunkyBob
        so... wait... are you just trying to test if a redirect happens?
      • kezabelle
        nah
      • Kayra has quit
      • wwnnbb
        Need help: i will add post update delete logic to my blog post view, what is better way to do it:
      • writing separate view for each action, and put form in context,
      • or override get post, and add update, delete methods in my View
      • I use Class Based Views
      • kezabelle
        trying to assert that the URLs in a feed (XML or whatever) align with those get_absolute_url calls
      • FunkyBob
        if you want to parse urls... use the urlparse lib
      • MblKiTA has quit
      • Kayra joined the channel
      • kezabelle
        urlparse(thing).path == obj.get_absolute_url() done
      • pgcd
        this is the relevant bit https://dpaste.de/AGYS
      • kezabelle
        urlparse(item.find('link').text).path
      • ecret has quit
      • Kayra has quit
      • MblKiTA joined the channel
      • Kayra joined the channel
      • MblKiTA has quit
      • pgcd
        kezabelle: ok, makes sense and it's probably a lot easier to understand for whoever reads the test
      • kezabelle
        bonus is you can also test the scheme, netloc etc too if you really want to
      • MblKiTA joined the channel
      • also means you can end up with querystring items in the feed and still be clear it represents the same object
      • pgcd
        kezabelle: yep, that's very true =)
      • ghostlines joined the channel
      • emorrow joined the channel
      • Kayra has quit
      • kushal has quit
      • kushal joined the channel
      • Vadims joined the channel
      • snurfery has quit
      • bee_keeper has quit
      • Vadims
        Hello everyone
      • could you help me to solve problem with CSS with django?
      • im fallowing tutorial part 1, and my admin panel doesnt accept static CSS file as CSS
      • Chrome console show me this error: Resource interpreted as Stylesheet but transferred with MIME type text/plain: "http://127.0.0.1:8000/static/admin/css/base.css".
      • hawkowl_work has left the channel
      • ticketbot has quit
      • what should i do to fix it?
      • ticketbot joined the channel
      • emorrow has quit
      • Andy80 joined the channel
      • MultiColourPixel has quit
      • hotsyk joined the channel
      • dali has quit
      • fumeboy joined the channel
      • nkuttler
        Vadims: are you using runserver?
      • Vadims
        yes
      • evrything step by step what says in tutorial
      • my main page where it says "it works" works fine and CSS applied
      • however admin panel broken, no CSS at all
      • nkuttler
      • sivy joined the channel
      • Vadims
        shows me CSS content
      • nkuttler
        :\
      • edbaffei joined the channel
      • Vadims
      • ctolsen joined the channel
      • what does it mean? the file is there as far as i see, in correct path, however it should be accepted as [type="text/css"] but used as [text/plain]
      • nkuttler
        Vadims: oh wait, do you have DEBUG set to True?
      • Vadims
        yes i do
      • You're seeing this message because you have DEBUG = True in your Django settings file and you haven't configured any URLs. Get to work!
      • nkuttler
        yeah, no idea tbh, never seen that
      • sivy has quit
      • Vadims
        i google a bit this problem, however there were problems more with javascript then css
      • but looks very similar
      • mark305 joined the channel
      • mark305
        hey guys, wondering if anyone can help with my question on SO regarding production deployment of multiple mprojects on one apache server? http://stackoverflow.com/questions/23394726/two...
      • Vadims
        but most of the answers related to the users projects which they creat - so problem is specific. in my case i didnt create anything.... it is just basic tutorial
      • cardboard joined the channel
      • abarax joined the channel
      • Naeblis joined the channel
      • Chive joined the channel
      • Linux_Asylum joined the channel
      • Linux_Asylum has quit
      • pydave6367 has quit
      • Left_Turn joined the channel
      • gabrielo has quit
      • ghostlines has quit
      • renemarxis joined the channel
      • atlasloewenherz joined the channel
      • ghostlines joined the channel
      • MblKiTA has quit
      • MblKiTA joined the channel
      • emorrow joined the channel
      • gabrielo joined the channel
      • milafrerichs joined the channel
      • atlasloewenherz has quit
      • emorrow has quit
      • renemarxis
        Hello i have some problem with nginx and gunicorn. I like to use gevent but it seems like my config is not correct. Using one worker and a long running django call blocks other calls to the app. Does someone see some error in my config files? Nginx: http://dpaste.de/Dfi5 and gunicorn http://dpaste.de/UAqH
      • milafrerichs has quit
      • hotsyk has quit
      • bee_keeper joined the channel
      • fission6 joined the channel
      • watermel0n joined the channel