#django

/

      • gentrooper
      • I appreciate you taking the time to look at it.
      • heaven00 has quit
      • heaven00 joined the channel
      • honi joined the channel
      • minim has quit
      • aeikenberry joined the channel
      • Laybunz has quit
      • ASUchander has quit
      • raonyguimaraes joined the channel
      • asaji
        FunkyBob: Funky do you have any idea why putting the actual IP address of the server as the gunicorn --bind makes it work?
      • i was doing 127.0.0.1 all this time and never getting it to work but now it does
      • FunkyBob
        gentrooper: so, either your form or your model validation needs to require it
      • djapo has quit
      • asaji: in what way didn't it work?
      • asaji: and do you have nginx or similar in front of it?
      • asaji
        FunkyBob: yup I'm using gunicorn/nginx, so basically this entire time it didn't work i was using a TCP bind 127.0.0.1:8001
      • gentrooper
        FunkyBob: I suspect a form is the right place to do that validation; but since I'm adding the m2m in the UserCreationForm, I wouldn't set up a separate form for the m2m, would I?
      • asaji
        FunkyBob: as soon as i switched it to my_server_ip:8001 it started working
      • thesheff17 has quit
      • FunkyBob
        asaji: "didn't work" how, exactly?
      • gentrooper
        in which case, I just need to figure out how to add m2m validation to the User form.
      • KingdomSprite joined the channel
      • asaji
        FunkyBob: Internal server error, couldn't find any logs on what was wrong though
      • FunkyBob
        asaji: have you given it enough detail to email you errors?
      • which can be as simple as adding your name+email to the ADMINS setting
      • asaji
        yeah i didn't get any emails either.. which is the weird part
      • FunkyBob
        well, does your server run a MTA? or did you configure the EMAIL_* settings?
      • thesheff17_ joined the channel
      • thesheff17_ has quit
      • asaji
        i configured the email settings
      • thesheff17 joined the channel
      • its just strange how it works when i put the external IP
      • FunkyBob
        set DEBUG=True and restart gunicorn... does it all work?
      • how did you configure nginx to talk to gunicorn?
      • asaji
        1 sec lemme try
      • well now that it works
      • i did this
      • upstream my_app { server x.x.x.x:8001; }
      • KingdomSprite
        So I need to change the User creation form inside the admin so only an email is required. A unique username (based on the email) will be generated as well as a unique password. Both of these need to be sent to the user. I am currently trying to use a custom class that inherits from UserAdmin, where the save_form fills in the password1, password2, and username (fills in the form instance values) and
      • save_model sends an email to the user. It isn't working, my user creation page (which only displays an email field) always states that there are errors.
      • asaji
        and under location / { proxy_pass http://my_app; }
      • dray3 has quit
      • FunkyBob
        asaji: well, whatever you put for x.x.x.x is what gunicorn needs to bind to
      • asaji: it really should be 127.0.0.1
      • asaji
        FunkyBob: ya sry x.x.x.x = my vps IP
      • FunkyBob
        KingdomSprite: so, you're not opting to use custom user model featore?
      • asaji: well, that's why... you told nginx to talk to gunicorn on that IP
      • asaji: please, stop believing in magic, and understand what you're doing
      • KingdomSprite
        FunkyBob: Well, no. I just want staff memebers to be able to add a user with only an email, instead of the traditional username and password.
      • PKKid2 has quit
      • asaji
        FunkyBob: right but when i did 127.0.0.1:8001 (having gunicorn bind to 127.0.0.1:8001 too) it throws internal server error
      • FunkyBob: okay so i switched it over to a socket and it works fine.. so weird
      • KingdomSprite
        I mean, it's pretty straightforward. I assume that I am probably just going to have to subclass the UserCreationForm class and somehow assign the values from there. https://gist.github.com/sethmoon/568cbf15d61cdf...
      • sohail joined the channel
      • FunkyBob
        asaji: that's because you put the wrong ALLOWED_HOSTS
      • probably
      • asaji: yeah, I prefer using socket over port
      • asaji
        FunkyBob: the socket bypasses ALLOWED_HOSTS?
      • velcrow has quit
      • FunkyBob
        KingdomSprite: yep, but wrangling it into admin ... not as easy
      • asaji: no, actually
      • asaji: more likely it's not trying to use the IP of its own port, since it doesn't have one
      • asaji
        FunkyBob: oh gotcha that makes sense
      • FunkyBob: I'm thinking the socket has less memory overhead too right?
      • rafadev has quit
      • jeffisabelle has quit
      • FunkyBob
        asaji: not sure about that, but (a) can't accidently be exposed outside the computer, (b) tends to be faster[no firewall], and (c) lets you do generic mappings of hostname -:> socket path
      • asaji
        FunkyBob: all pluses :)
      • FunkyBob
        yes
      • asaji
        FunkyBob: btw thanks so much for the suggestions and help
      • FunkyBob
        this is pretty much my nginx config -- http://musings.tinbrain.net/blog/2010/sep/30/dj...
      • asaji
        FunkyBob: the damn thing is finally working
      • yeah i did something very similar
      • FunkyBob
      • asaji
        is this necessary? proxy_set_header Host $http_host;
      • oh this is neat, this is your blog?
      • luyikei__ joined the channel
      • FunkyBob
        yes
      • I'm trying to restructure the "book" part to be more generic
      • asaji
        if i may suggest, you should use the google code box or gist for the code pastes
      • it looks neater imo
      • hkj has quit
      • FunkyBob
        yah... I need a restyle of the whole site, tbh
      • asaji
        are you using bootstrap for css?
      • george_e joined the channel
      • FunkyBob
        foundation
      • think I'll ditch it and give purecss a try
      • asaji
        yeah i've read good things about pure
      • FunkyBob
        because it seems to have everything that I used to like about foundation
      • mostly -- really light markup
      • george_e
        I have connected a method to the pre_save signal for a model. This model has a FileField and I would like to get the full path to the file on disk before it is saved in the storage backend.
      • Is this possible?
      • asaji
        bootstrap 3 seems pretty light.. haven't tried it though
      • george_e
        asaji: I've used Bootstrap 3. It's pretty light.
      • heaven00 has quit
      • asaji
        there ya go ^
      • FunkyBob
        george_e: in most cases, no, since it doesn't have a file on disk yet
      • light compared to what?
      • george_e
        FunkyBob: Well, compared to jQuery UI, for example.
      • FunkyBob
        so... a rather meaningless comparison :)
      • george_e
        FunkyBob: How do I perform validation on the file contents then if it is not stored in an accessible location?
      • FunkyBob
        you read the file data from the field
      • george_e
        FunkyBob: Ah, okay. I think I get it now.
      • mayhew has quit
      • Thanks for clearing that up.
      • velcrow joined the channel
      • gentrooper
        FunkyBob: Any recommendations for how best to validate the intermediate model? I don't *think* I can use a separate form for the intermediate, since it's inline to the User form.
      • KingdomSprite
        FunkyBob: Do you have Sass set up on your machine? It makes Foundation so much easier.
      • FunkyBob: The best part is that you can use Sass to compile to 1 css files.
      • FunkyBob
        KingdomSprite: it doesn't stop foundation requiring such heavy markup
      • KingdomSprite
        FunkyBob: I like Foundation over bootstrap. It's more readable writing class="large-3 columns" and class="large radius success button"
      • Forgetful_Lion has quit
      • FunkyBob: But if you know Sass, you can change all that. You can make <header> act like 12 columns using the mixins.
      • knite joined the channel
      • bwreilly has quit
      • minim joined the channel
      • empty has quit
      • bwreilly joined the channel
      • knite has quit
      • telex has quit
      • telex joined the channel
      • jacksmith has quit
      • mstrcnvs joined the channel
      • sohail has quit
      • arturrro joined the channel
      • jacksmith joined the channel
      • Milossh has quit
      • gazumps joined the channel
      • Milossh joined the channel
      • pucko
        hmm, how can a I make a form retain its filled in values for display again after a POST?
      • knite joined the channel
      • asaji has quit
      • Hipikat joined the channel
      • santagada has quit
      • mattmcc
        Pass request.POST to the form's data argument.
      • endra joined the channel
      • pucko
        yeah, tried that but no success. funny enough, the data is retained if there was a validation error. but not if it is successful
      • mattmcc
        Well, paste your view.
      • Er, but why would you want to redraw and repopulate the form if it was successful?
      • polishnorbi joined the channel
      • Doesn't that just make it really easy to accidentally repost the same data?
      • velcrow has quit
      • pucko
        hm, yeah. that could be an issue.
      • you're right, less confusing. so I'll find another way
      • skiernose has quit
      • ojii has quit
      • ojii joined the channel