#django

/

      • dillonreyna
        But findstatic for that hierarchy returns the same error
      • Crystalk3
        FunkyBob: Ok, I created the permission putting it in a model from the same app that's going to use the view restrictions, added the permission to the group in the shell, and got it to work
      • However this kind of sucks a tiny bit and I'm waiting eagerly for your patch
      • Thanks for your help
      • Merry christmas and a happy new years
      • thiras has quit
      • amcorrei1 is now known as amcorreia
      • jaz- has quit
      • jaz- joined the channel
      • FunkyBob
        dillonreyna: not quite
      • dillonreyna: as I said earlier, the path is relative to the static/ dir
      • so in that case you should put {% static 'css/style.css' %}
      • do a "manage.py findstatic css/styyle.css" and see what it finds
      • dillonreyna
        Sure.
      • Says it was found here: /Users/dillonreyna/Desktop/Projekten/Django/advice_site/frendly/Profile/static/css/style.css
      • FunkyBob
        which is the file you want, right?
      • dillonreyna
        Correct.
      • FunkyBob
        so that's what you need to put in your template
      • dillonreyna
        So href="{% static 'css/style.css' %}"
      • FunkyBob
        yes
      • dillonreyna
        That's what I have right now
      • <link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}" />
      • {% load static %} at the top of the html document
      • FunkyBob
        and what url does that render to ?
      • as in, in the browser, what is that link showing as?
      • dlam joined the channel
      • dillonreyna
        '0.0.0.0:8000' (assuming I understand the question correctly)
      • FunkyBob
        no
      • dillonreyna
        Haha, figured.
      • FunkyBob
        are you saying in the "view source" it shows as <link rel="stylesheet" type="text/css" href="0.0.0.0:8000" /> ?
      • stevanr has quit
      • dillonreyna
        Ahhh, no.
      • It's showing up as 'static/css/style.css'
      • rather '/static/css/style.css'
      • FunkyBob
        so what is your STATIC_ROOT set to, exactly?
      • dlam has left the channel
      • dillonreyna
        STATIC_URL = '/static/'
      • Dunedan joined the channel
      • I'm probably super late on asking, but would it make this easier if I sent you the GitHub link?
      • FunkyBob
        meh... you learn more by trying the steps I would take to debug it, surely?
      • ok, so in your template you have {% static 'css/style.css' %}
      • settings.STATIC_URL = '/static/' ...
      • dillonreyna
        Definitely. I like to struggle when I learn. And yes, that's correct.
      • FunkyBob
        so in the rendered template it really ought to be href="/static/css/style.css"
      • optiz0r joined the channel
      • sms
        What's the typical way you handle post expiration dates
      • Dunedan_ has quit
      • dillonreyna
        FunkyBob: isn't that what I already have?
      • sms
        I know I could run a cronjob on the system to go through the db and check if current time > expiration date
      • FunkyBob
        dillonreyna: you said it shows href="static/css/style.css"
      • the lack of leading / is bad
      • dillonreyna
        I corrected myself thereafter, it shows the leading /
      • I see how I can be misleading ;)
      • FunkyBob
        how did you correct that?
      • dillonreyna
        I meant that I had mistyped.
      • THe browser was showing the initial forward slash
      • FunkyBob
        ok, and a hard refresh in your browser still gets a 404 for that?
      • dillonreyna
        Yep
      • WAIT
      • IT WORKS NOW AND I DONT KNOW WHY
      • FunkyBob
        heh
      • welcome to coding :)
      • dillonreyna
        It smells like fire and everyone's crying.
      • I'll love it here.
      • Crystalk3 has quit
      • junkpiano joined the channel
      • Bryson joined the channel
      • gugah has quit
      • junkpiano has quit
      • ironfroggy joined the channel
      • dillonreyna has quit
      • vdamewood has quit
      • Valduare
        hows it going
      • jadajada has quit
      • sunil_bansal joined the channel
      • FunkyBob
        wonder how long it's been since I last submitted a PR to django
      • Valduare
        too long if you dont remember :)
      • are you familiar with django rest framework?
      • FunkyBob
        I know of it
      • why do you ask?
      • Valduare
        i just came across it earlier tonight
      • FunkyBob
        I tend to use my own API lib, django-nap
      • sunil_bansal has quit
      • Valduare
        ah nice
      • fikka joined the channel
      • vdamewood joined the channel
      • fikka has quit
      • miz- joined the channel
      • maks25 has quit
      • maks25 joined the channel
      • ironfroggy joined the channel
      • max3 has quit
      • saurabhwahile joined the channel
      • ckot has quit
      • saurabhwahile
        Hello, I am having an issue of the csrf token not being set, from the django server itself (Missing Set-Cookie header) how do I force the view to set the cookie? The view is a DjangoRestFramework view
      • FunkyBob
        saurabhwahile: there's a decorator that will ensure the cookie is set for a view
      • saurabhwahile
        FunkyBob: I have used the @method_decorator(csrf_protect) decorator
      • for the view
      • These are the only headers returned. https://pastebin.com/8yXTQ2Lm I am using the development server
      • FunkyBob
        no, you need ensure_csrf
      • saurabhwahile
        okay, let me try that
      • FunkyBob
        ensure_csrf_cookie
      • saurabhwahile
        okay 1 sec
      • Thank you!!!!!!!!!! I wasted so much time on this :(
      • Bryson has quit
      • saurabhwahile has quit
      • maks25 has quit
      • b0nn
        ^ I think the more time you 'waste' on a problem, and the more frustrated you get with it, the sweeter the taste of the solution, and the more likely you are to note it down and remember it
      • Wall_of_Yawn joined the channel
      • jadajada joined the channel
      • sms
        It's a diminishing return
      • You should reach out for help sooner, don't waste days banging your head against the wall
      • FunkyBob
        +1
      • sms
        Especially if you suspect it might be a language/framework feature
      • jessamynsmith has quit
      • khomesh joined the channel
      • Donitzo has quit
      • jadajada has quit
      • ironfroggy joined the channel
      • nimbleark has quit
      • b0nn
        I dunno, I have some problems in my head that I have been working over and teasing out for over a decade
      • sms
        Depends on the problem
      • b0nn
        Also, I've been in teams where juniors are treated *very* badly for asking questions because they're lost
      • Actually, every team I've been in has behaved like that
      • sms
        Yeah, I mainly meant reaching out in IRC's/forums
      • It's different to ask help from your colleagues
      • b0nn
        um, you can't ask anyone else for company specific information
      • techno_x64 has quit
      • sms
        Never said otherwise
      • sunil_bansal joined the channel
      • b0nn
        what??
      • Donitzo joined the channel
      • sunil_bansal has quit
      • FunkyBob
        b0nn: sounds like you've been in shitty teams
      • b0nn
        FunkyBob: enough to make me not want to work in offices
      • but yeah, I can't think of a team I've been in where I've thought, wow, these people treat others like human beings
      • sol1x has quit
      • FunkyBob
        wait... where are you, again?
      • b0nn
        unemployed :)
      • FunkyBob
        and I can't fix that if you keep giving smart-arse answers
      • b0nn
        huh
      • not sure what you mean by fix that
      • So, back to my whine, here in Australia, team I was in, I was the 3rd person to leave the team in under 12 months (and I've heard they've since chewed through another 3
      • darkhanb
        How to correctly access the remote ip?
      • b0nn
        Then, took a gig as a contractor, the guy did his nut at me because I was using the mysql command line client, and he claimed that meant I didn't want his help
      • darkhanb
        request.META["REMOTE_ADDR"]?
      • b0nn
        (There were other issues too, but that was the final straw)
      • FunkyBob
        darkhanb: well, it's not entirely reliable
      • b0nn
        There's this too x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
      • darkhanb
        oh I see, that's right