#django

/

      • iiie
        PROJECT.wsgi.application(environ, start_response) ?
      • lacrymology
        FunkyBob: all of our sites depend on a skeleton project that gets updated all the time, so yes
      • FunkyBob
        you could just run a regular urllib2. request
      • lacrymology: ok
      • lacrymology
        FunkyBob: and.. I don't really know, he wants it, and I've gotta do it :) It catches some errors, too, and I'm sort of unit tests
      • iiie: that's what he did, and he said it didn't work. I'm in the middle of a big update in my virtualenv right now, so I can't see how did it fail
      • FunkyBob
        post_fork is probably the goal... as it gives you a handle on the worker
      • lacrymology
        or what he means by "fail", exactly =/
      • FunkyBob
        "It doesn't work"....
      • you wonder if people like that take their cars to the mechanic and say "There's something wrong with it."
      • iiie
        only thing I can think of is a dependency of running in virtual env (I've seen code that depended on the virtual env active [environment variables] not just the right paths)
      • "It has problems, I'll leave it to you to find out what"
      • Pochacco joined the channel
      • lacrymology
        FunkyBob: I've never done any of this wsgi stuff before, so I'm a little at a loss here, I don't know when this is running. He did it in the wsgi application file, he does application = WSGIHandler(); application({'SERVER_PROTOCOL': 'HTTP/1.1', 'REQUEST_METHOD': 'GET'}, None)
      • dlams joined the channel
      • iiie
        Does the admin set DJANGO_SETTINGS_MODULE? os.environ.setdefault("DJANGO_SETTINGS_MODULE", "PROJECT.settings")
      • It sounds like he's making his own file to run the test
      • lacrymology
        iiie: I think this is one of the wsgi hooks
      • iiie
        WSGIHandler is https://github.com/django/django/blob/master/dj... that parts fine so long as django is told where the settings file is.
      • joshfinnie joined the channel
      • lacrymology
        iiie: yes, it does
      • well
      • I'm gonna go
      • it's too late
      • iiie
        best of luck
      • ben_nicoll joined the channel
      • stuntmachine joined the channel
      • kiler6
        when can I change settings.SECRET_KEY ?
      • FunkyBob
        in settings.py
      • WHY do you want to change it?
      • kiler6
        no
      • i mean... if someone get this SECRET_KEY for some reason
      • i need to change
      • FunkyBob
        so put in a big random string
      • or change one char
      • kiler6
        is SECRET_KEY only about session security ?
      • no influence about database
      • ?
      • resixian joined the channel
      • FunkyBob
        I think it's used in a couple of places for secure hashing
      • iiie
        right, csrf will break for outstanding rounds (next attempt would work though)
      • kiler6
        FunkyBob: my doubt is: can i change and it is ok ?
      • FunkyBob
        it will mean all sessions will be dropped...
      • yes, you can change it
      • hmm
      • tdrizzy joined the channel
      • it's worth grepping the django source and see where it's used
      • I don't _think_ it's used for passwords... but I might be wrong
      • kiler6
        FunkyBob: and should i share the same SECRET_KEY in my production and development environment ?
      • FunkyBob
        ideally no.. but that's not always an option
      • a quick scan through the soruce tells me it's used only for singning .. for MAC... so you should be fine
      • graingert
        FunkyBob: it would be handy to have a SECRET_KEY array
      • FunkyBob: so that you can drop down to use old keys for a key rollover
      • Pochacco joined the channel
      • FunkyBob
        graingert: except, unless you're very disciplined [and paranoid], you'd only do a key rollover when you lose trust in the key
      • so you wouldn't want to accept the old ones
      • ben_nicoll joined the channel
      • ambar_ joined the channel
      • iiie likes the idea of rotating through secret key, but there would probably be a timing attack (though that would only show which key was used or rather how many keys failed before one worked)
      • heh
      • easy to fix... always test all keys
      • iiie
        or tests that take the same time / calculations with a bogus key; sounds like fun! :)
      • FunkyBob
        heh
      • there is generally a cost for effective security
      • _di joined the channel
      • ojh joined the channel
      • czue joined the channel
      • arrty joined the channel
      • so, i had a crazy idea on the train to work this morning
      • why not let me use objects in the context as filters?
      • iiie
        so one variable is passed to another?
      • tWoolie joined the channel
      • FunkyBob
        so you can pass a single argument to any method of an object in the context
      • probably opens a can of worms security wise...
      • also, by the looks, filters are verified at compile time
      • stuntmachine joined the channel
      • theneb
        If in my database I have "{% trans 'foo' %} $20", Can I put this into a template and have it evaluated using templatetags?
      • FunkyBob
        theneb: not without a special tag
      • I have a {% template %} tag in gnocchi-cms that re-parses the rendered content as a template
      • theneb
        FunkyBob: Okay, I won't store it in the database then and store the raw data instead. Cheers
      • FunkyBob
        n
      • np
      • mgrouchy joined the channel
      • dali joined the channel
      • dazzler
      • spulec joined the channel
      • hyperair joined the channel
      • ben_nicoll joined the channel
      • czpython joined the channel
      • czpython
        is it possible to get the matching and not matching part of a filter expression ?
      • gry joined the channel
      • like
      • active, inactive = Sample.objects.filter(active=True)
      • inactive being the part of the expression that did not match
      • mattmcc
        That would mean you don't actually want to filter it.
      • BlackCherry joined the channel
      • hell_razer joined the channel
      • FunkyBob
        czpython: sounds more like you want to sort
      • Cromulent joined the channel
      • czpython
        hmm good point
      • JanC joined the channel
      • kenbolton joined the channel
      • hansy joined the channel
      • home joined the channel
      • cadomeireles joined the channel
      • cadomeireles joined the channel
      • b3free joined the channel
      • katsh joined the channel
      • dali joined the channel
      • dlams
        built in login view doesn't redirect if accessed by an auth'd user?
      • henriquebastos joined the channel
      • andredieb joined the channel
      • BlackCherry joined the channel
      • mattmcc
        Nope.
      • m0n5t3r joined the channel
      • w0ng joined the channel
      • explodes joined the channel
      • chrisjones joined the channel
      • Keeyai
        I have a problem that I run into sometimes on my dev machine -- after hitting the same pages over and over and over and over while coding/testing, it will sometimes start giving me 'mysql server has gone away' errors
      • the mysql server has not gone away, other pages work, manage.py shell works
      • the cursors are not recycled in my cade
      • code
      • the same exact stuff works using a different browser
      • for a while
      • but it eventually gets 'locked out' too
      • any ideas?
      • FunkyBob
        never use mysql, so couldn't say
      • Keeyai
        :(
      • FunkyBob
        actually
      • did have something vaguely similar happen with pg... but I doubt you've deliberately disabled the signal handler that disconnects the DB after each request
      • Keeyai
        I havent
      • Pochacco joined the channel
      • ReekenX joined the channel
      • ThePicard_ joined the channel
      • ThePicard_
        heyo, on https://docs.djangoproject.com/en/dev/topics/au... it says the url name is login
      • and references the named url patterns documentation
      • pydanny joined the channel
      • how would I use that url name?
      • FunkyBob
        firstly, are you using a git checkout of Django?
      • ThePicard_
        (side question, everywhere in the docs it says use {% url 'name' %} but I've found that that doesn't work and I have to use no quotes eg {% url name %}
      • tdrizzy joined the channel
      • FunkyBob: no, now that you mention it
      • FunkyBob
        wow... so in the docs you link to ... second line: "See the URL documentation for details on using named URL patterns"
      • ThePicard_
        FunkyBob: yes.
      • FunkyBob
        ThePicard_: stop referencing the dev docs, then
      • ThePicard_
        I know that
      • okay, new question then. How do I specify a default url name like this view seems to do?
      • FunkyBob
        what do you mean by a "default" url name?
      • and did you read the docs that links to on naming url patterns?
      • ThePicard_
        that's what the URL name: login