#django

/

      • b0nn
        FunkyBob: there's nothing sane about this dev environment
      • transit
        b0nn: Are you familiar with setting up the python interpreter in PyDev?
      • b0nn
        not really
      • changlp has quit
      • transit
        Is your project listed?
      • (Did you create or import the project into pydev?)
      • jarshwah joined the channel
      • jwarren_
        FunkyBob is there a simple way to target that warning and silence it explicitly? Is there something I can drop into my settings?
      • b0nn
        project is listed
      • jarshwah has quit
      • FunkyBob
        jwarren_: there is... I just never used it... lemme check
      • transit
        Ok, right-click on the project and select Properties at the bottom.
      • jarshwah joined the channel
      • FunkyBob
      • jwarren_
        The only thing I was able to track down was catching deprecation warnings, but this wouldn't be that.
      • FunkyBob
        jarshwah mihgt know :)
      • theology
        so everytime I do MyModel.objects.all()[0] I get a different MyModel. What is going on here?
      • transit
        Then select "PyDev - Interpreter/Grammar"
      • FunkyBob
        theology: you didn't set an order
      • jwarren_
        How on earth do you find these documentation links so quickly??
      • FunkyBob
        theology: so the DBMS is free to retrieve any record it likes
      • jarshwah: 12 years of practice?
      • theology
        FunkyBob, is it not set by default?
      • transit
        Click "Click here to configure an interpreter not listed."
      • FunkyBob
        theology: did YOU specify one?
      • theology
        FunkyBob, no
      • FunkyBob
        theology: either on your queryset, or on your model?
      • theology
        i never have
      • FunkyBob
        then what order would you expect to be the "default"?
      • theology
        on any project, but this has never happened before
      • b0nn
        transit is this where you are heading? http://imgur.com/a/ld7MK
      • transit
        Click "New..." then find the python binary for your virtualenv.
      • Yes.
      • b0nn
        it took me an age to find a decent image upload place
      • theology
        like, User.objects.all()[0] is always the first superuser for all of my projects FunkyBob
      • cebor has quit
      • FunkyBob
        theology: pure luck
      • theology
        oh
      • cebor joined the channel
      • FunkyBob, thanks for the info man, was really confused
      • FunkyBob
        np
      • cebor has quit
      • b0nn
        do I have to load each variable one at a time?
      • cebor joined the channel
      • FunkyBob
        theology: sorting takes time/work... so don't ask the DB to do it unless you need it
      • b0nn
        or can I bulk load them?
      • hamub has quit
      • theology
        FunkyBob, right
      • FunkyBob
        b0nn: this is why I like envdir
      • transit
        I've never had to do more than a couple...don't know if there's a way to bulk-load them.
      • b0nn
        FunkyBob: I've never done this before, so I have no idea what's easiest
      • FunkyBob
        b0nn: this is also why I wrote the env tool in django-classy-settings to have a default :)
      • b0nn
        transit, ok I'll one by one them
      • adu joined the channel
      • transit: how do I run the export commands?
      • transit
        Example?
      • b0nn
        export DATABASE_URL
      • franklyrosalind has quit
      • transit
        You wouldn't run them, these environment variables will just be set before the interpreter gets spun up.
      • FunkyBob
        I think I just learned something new about descriptors
      • transit
        b0nn: I think you'll have to give a value to any vars that are purely 'export myvar'.
      • b0nn
        ok, how do I run the second source command
      • which is a bash script that sets up the virtual pythonhome (etc)
      • transit
        The second source command is effectively set up to run automatically when you choose the python binary inside it.
      • (inside the virtualenv)
      • moldy
        ``source /my/venv/bin/activate; python;`` is more or less the same as ``/my/venv/bin/python``
      • transit
        _what moldy said_
      • moldy
        so if you point eclipse that /my/venv/bin/python, that should mean you're using the virtualenv
      • until something goes wrong ;)
      • b0nn
        that's not what I want
      • moldy
        what's the problem with it?
      • b0nn
        it can't find the modules
      • moldy
        it should. if it doesn't, find out why.
      • you may need to add your project base dir onto the path as well
      • b0nn
        so, to run it from commandline I go.. ../env/bin/activate; then make runserver
      • moldy
        or you just do /env/bin/python manage.py runserver
      • b0nn
        no
      • not at all
      • moldy
        if that throws an error, show us the full traceback
      • b0nn
        which one?????
      • dro32 has quit
      • moldy
        the one you want help with? ;p
      • b0nn
        transit: How do I run the ../env/bin/activate?
      • moldy
        `activate` is not dark magic. it all it does is setup your path such that you can type `python` insead of `/env/bin/python`. stop focussing on `activate`, show us what you're droing and the full traceback
      • b0nn
        moldy, no.
      • Seaninho joined the channel
      • moldy
        ok, i'm out. good luck.
      • transit
        You wouldn't, python myscript will run myscript in the virtualenv that you set up with the custom python interpreter.
      • b0nn
        step away from the kb
      • transit
        What does `make runserver` do?
      • b0nn
        transit: in bash I would run source ../env/bin/activate
      • ok, so the problem is you're one step ahead
      • BEFORE I can run the runserver, I need to activate the environment
      • moldy
        you don't
      • transit
        you don't
      • jessamynsmith joined the channel
      • b0nn
        then why does it error
      • moldy
        activating the environment is *always* optional
      • show us the error...
      • exaroth joined the channel
      • b0nn
        telling me the enviromnment isn't setup
      • transit
        What are you running that tells you the environment isn't set up?
      • b0nn
        moldy: ModuleNotFoundError: No module found 'foo.bar'
      • moldy
        b0nn: full traceback please, on dpaste.com
      • b0nn
        transit: the effing run button
      • moldy: if I could I would have long ago
      • moldy
        01:16< moldy> you may need to add your project base dir onto the path as well
      • it's probably this, but we need more info to tell
      • transit
        Next to the effing run button there is a little down arrow.
      • b0nn
        I have NFI what you mean
      • transit: yes
      • the run configurations
      • moldy
        show us the real traceback, all of it, don't replace stuff with `foo.bar`
      • transit
        Under run (or debug configurations what is the main module?
      • moldy
        the real values for `foo` and `bar` are important for us to understand your problem
      • b0nn
        ${workspace_loc:work/manage.py}
      • transit
        (and I second moldy's suggestion for a traceback)
      • FunkyBob
        moldy: you know how I say you shouldn't fight y our tools? sometime you have to stop fighting to help someone ,too... :/
      • b0nn
        I'm more than aware how hard it is to debug in the dark
      • rethil has quit
      • moldy
        FunkyBob: yeah, i'm sorry, i guess i should step back
      • transit chuckles at FunkyBob's comment.
      • FunkyBob
        moldy: no... fight as long as you like... just, don't lost your happy doing it
      • moldy
        i'm handing this off to the other competent folks here :)
      • transit
        FunkyBob killed moldy :(
      • rethil joined the channel
      • moldy
        no worries :p
      • b0nn
        finished?
      • rkj has quit
      • transit
        b0nn: and the arguments?
      • b0nn
        runserver_plus localhost:8000
      • transit
        and your virtualenv paths are in PYTHONPATH?
      • b0nn
        pass
      • how do i check?
      • tourdownunder joined the channel
      • Digitaltom has quit
      • FunkyBob
        echo $PYTHONPATH
      • transit
        The same place where the main module is shows what pydev thinks the PYTHONPATH is for that run.
      • b0nn
        FunkyBob: having them in bash and getting them into eclipse is two different things (and the problem I am trying to fix)
      • transit: sorry, you've lost me
      • jessamynsmith
        b0nn: it's been a lot time, but I think you can set environment variables for eclipse
      • transit
        In the run/debug configurations dialogue, there will be a PYTHONPATH section below the 'Main Module' section.
      • jessamynsmith
        I ended up switching from eclipse to pycharm in part because it makes these things simpler
      • FunkyBob
        can't you make your activate script source your settings one?
      • b0nn
        jessamynsmith: I've tried pycharm in the past, I hated it
      • transit
        It should be already, I'm just helping him troubleshoot.
      • b0nn
        /more/ than I hate working on a mac
      • jessamynsmith
        b0nn: interesting, I found it quite similar to eclipse
      • b0nn
        ok, in bash the echo $PYTHONPATH command returns an empty string
      • transit
        I think we're miscommunicating...not sure where you'd put echo $PYTHONPATH.