#django

/

      • Jayflux
        you know how to pull it down and read it like a webpage?
      • Ive pulled it down but everthing is in .rst files
      • finspin
        hi guys, django (and programming) beginner here. im looking for some resources how to work with authenticated users. once user logs in he should see only content related to him. he should be able to store some data. how to design models/views/templates to handle this? the tutorials i found all deal only with authentication, not what happens after that. could you point me to the right direction? maybe im using wrong keywords to search
      • Architekt_
        svkoskin: It depends on your use case. You may sometimes miss that feature. But you can always define special method for returning all objects in your custom manager.
      • apollo13
      • leotr
        thank you
      • brrt has left the channel
      • leotr has quit
      • joshuajoshua
        finspin, Custom managers and the authentication system are pretty simple.
      • MicahCarrick has quit
      • cebor has quit
      • md4d has quit
      • Architekt_
        Jayflux: Sphinx can make html from rst sources.
      • sayan has quit
      • arietis joined the channel
      • briancray joined the channel
      • thiderman has quit
      • finspin: It's simply described in docs: https://docs.djangoproject.com/en/1.4/topics/au...
      • kushal has quit
      • twoface
        When using DEBUG=True, a page that normally loads in 2-3 seconds, now takes about 20seconds. Profiling the view, I can see most of time is spent in posixpath.py - mainly 'join', 'islink' and 'realpath'. What would cause that?
      • joshuajoshua
        twoface, Take a look at the sql queries
      • apollo13
        hu?
      • joshuajoshua
        django debug toolbar is your friend here
      • twoface
        joshuajoshua, the sql queries are no problem - they take about 120ms
      • in total
      • apollo13
        twoface: show the debug output, if posixpath is on the top probably heavy template rendering
      • enable the cached template loader to confirm that
      • nedbat joined the channel
      • nedbat has quit
      • kezabelle
        nah
      • oops, wrong window
      • nedbat joined the channel
      • twoface
        apollo13, i do use a number of includes in loops, so that might be it
      • i'll try with the cached loader
      • Guddu has quit
      • antihero has quit
      • finspin
        Architekt_: thanks, i've checked that link already. it describes login / logout etc. but i haven't found anything related to users storing data. here is a basic scenario: user logs in to his account, fills a form and saves it. how do i do it in django? as far as i can tell the resource you linked to doesn't describe that. or am i missing something?
      • antihero joined the channel
      • Shariq joined the channel
      • joshuajoshua
        finspin, How is that user specific? Do the tutorial.
      • DO THE TUTORIAL!!!
      • It will all become within your reach one you do it.
      • napperjabber_ joined the channel
      • finspin
        joshuajoshua: you mean the poll tutorial?
      • joshuajoshua
        Yes
      • tuxcanfly has quit
      • NoobCoder joined the channel
      • napperjabber has quit
      • thehandler has quit
      • bahamas joined the channel
      • matthearn777 joined the channel
      • Jayflux
        If i have a view thats reusing certain functions and I want DRY, do i just use a class based view?
      • twoface
        apollo13, cached template loader made no real difference - deactivating the debug toolbar did, however. i've never had problems with it before :/
      • apollo13
        twoface: haha, the debug toolbar reads the template files, that might cause a "few" calls ;)
      • twoface
        apollo13, a "few" would in this case be about three million :)
      • apollo13
        that I probably would debug
      • gerard0 joined the channel
      • twoface
        but turning off debug toolbar and using cached template loaders, i've gone from ~20s to 0.2s
      • Y3Klo joined the channel
      • Y3Klo
        Hello everybody.
      • I need a HTTP Proxy for Django, to send all the MySQL / PGSQL data through a HTTP Tunnel.
      • Can someone help me with that please?
      • apollo13
        wtf?
      • joshuajoshua
        twoface, Sounds like something was done in a template that should have been done in vanilla Python.
      • Y3Klo, How is that even django related? Just use an SSH tunnel
      • Cromulent joined the channel
      • ObseLeTe joined the channel
      • tWoolie joined the channel
      • Y3Klo
        joshuajoshua: I can't use SSH tunneling, it must be HTTP...
      • twoface
        actually, my previous statement is incorrect - my profile just ate an exception :/
      • joshuajoshua
        You can tunnel whatever port you want with ssh
      • apollo13
        Y3Klo: why would one even tunnel db access through http?
      • joshuajoshua
        I was wondering that.
      • kezabelle
        I love debug toolbar, but it does slow everything right down ;)
      • joshuajoshua
        kezabelle, Good thing users dont see it.
      • twoface
        i'm just surprised that it slows it down this much :/
      • kezabelle
        pfft, i do though
      • SQL queries and templates + context can easily mean 1-2 seconds to render :(
      • joshuajoshua
        You alsu use DEBUG=True and the dev server so you lose either way.
      • Y3Klo
        apollo13, joshuajoshua: Hard to explain, but it can't be reduced to one word: Firewall (and SHH isn't an option unfortunately)
      • apollo13
        Y3Klo: well django won't get in your way, writing your own sql backend might get fun though
      • and I'd rather invest in a sane environment, everything else is just stupid
      • joshuajoshua
        Y3Klo, firewalls exist for a reason. Why not open a port so that you can actually get work done?
      • SSH can operate on any port and can tunnel any other port. If you have an open port, SSH will work.
      • Y3Klo
        apollo13, joshuajoshua: So, there isn't any solution for that? Beside re-write the SQL Backend of curse.
      • joshuajoshua
        Or a ten second ssh tunnel, but thats "not and option"
      • apollo13
        Y3Klo: why would there? it's completly insane from any point of view
      • joshuajoshua
        Why do you have this firewall restriction?
      • gerard0 has quit
      • j_syk joined the channel
      • xpen joined the channel
      • "Hard to explain", we can't give you a solid answer without knowing anything.
      • juliaelman joined the channel
      • Y3Klo
        joshuajoshua, apollo13: Once again, I CAN NOT use SHH nor edit the firewall, it's a shared hosting, and no, I can't whitelist the IP 'cause it's coming from Heroku.
      • adema joined the channel
      • joshuajoshua
        ah, the ole "I only spend $5 a year on a core part of my business" defence.
      • Man up and get a usable server.
      • MicahCarrick joined the channel
      • Y3Klo
        joshuajoshua: It isn't not my business, and actually, it isn't even a business... But thanks for your help.
      • joshuajoshua
        Seriously, why not remove this restriction.
      • mastergreg joined the channel
      • You could just put the DB somewhere else. That's the obvious way to solve this.
      • caleb_smith joined the channel
      • apollo13
        Y3Klo: I just think that working around your requirements is way more work than do something else
      • mattmakai joined the channel
      • finspin has quit
      • Y3Klo
        joshuajoshua, apollo13: It sounds right, it wasn't an requirement (I DO have other places to put the DB too), I'm just curious about this HTTP Tunneling thing and wanted to try&learn.
      • joshuajoshua
        You can't do anything if the server is not listening on that port and you have no access to the server to reroute firewall ports or tunnel.
      • If you had access, this would be a single line fix in iptables.
      • bullicon has quit
      • Y3Klo
        joshuajoshua: Yes, I know about that. The server is located in JustHost, is DOES allow IP whitelisting, the big problem is the cloud platform (Heroku), it doesn't have only 1 IP, and I don't even know the full list of them too.
      • sayan joined the channel
      • joshuajoshua
        That's a bad idea, you need to move this somewhere you can actually use it.
      • You have no tunnel or forward options. Learn sometime later when you actually have the materials to learn it.
      • Y3Klo
        joshuajoshua: I've a dedicated server in HostGator, again, I'm just wanting to "try&learn"...
      • meekohi has quit
      • I've succesfully installed a HTTP Tunnel with PHP as Server and Python as client (with an HTTP Proxy), I just came here to ask about django, how easy or hard would be to implement that.
      • evildmp joined the channel
      • cheshair joined the channel
      • joshuajoshua
        How ould you even use PHP as a proxy? Why not just use the webserver? Either way, both of these options are horribly inefficient when you could just fix it. There's never a good reason to learn how to http proxy DB connections.
      • tdelam
        why not just use a web server?
      • estebistec joined the channel
      • joshuajoshua
        That's like asking how to make your car run on hotdogs.
      • tdelam
        lol
      • Y3Klo
        LOL
      • colinbits joined the channel
      • joshuajoshua
        You could learn, but it would be completely useless information.
      • Y3Klo
        Ok, it's a bad (or extremely useless) thing to learn then, thank you guys.
      • dali has quit
      • tdelam
        It could be just for fun, short answer is yes it is possible with Django, you're not limited in any way.
      • LiNT joined the channel
      • Y3Klo
        tdelam: That why I tried to explain since the beginning, not a big problem neither :)
      • tdelam
        :)
      • Ixbidie joined the channel
      • personally I would make sure that PHP is never installed on a server though
      • joshuajoshua
        DEF
      • or mod_python
      • Y3Klo
        tdelam: Lol, me neither, but it's already running on the server.
      • joshuajoshua
        Hell, I like to make sure Apache is never installed on a server.
      • apollo13
        tsts
      • tdelam
        gotcha :) that's a good goal to have; remove all dependencies on PHP. I made it mine at this office and it's worked.
      • exit2 joined the channel
      • Y3Klo
        Then the question actually is... Why are Apache and PHP used yet!
      • tdelam
        apollo13: heh, I actually don't mind apache.
      • er joshuajoshua *
      • joshuajoshua
        I don't either, but it drives me crazy when I see people proxy info from nginx to apache on the same damn server. Why have another huge blaoted webserver when you've already got a fast light one?
      • Ixbidie has quit
      • mod_wsgi isn't that great.
      • apollo13 is looking how to mute people ;)
      • FunkyBob
        hehe