#django

/

      • hoody_k has quit
      • leandroa has quit
      • maxsong1002 joined the channel
      • maxsong1002
        I have a question!
      • How is everyone doing with their weekends?
      • bkuberek joined the channel
      • incitonetworks
        good
      • PlasmaSheep joined the channel
      • PlasmaSheep
        I feel like I'm missing something pretty obvious here, but is there a way to associate a url with a static template without writing a view for it?
      • mattmcc
        You can use the render shortcut.
      • It is a view, after all. It takes a request and returns a response.
      • culturelabs has quit
      • maxsong1002
        I want to run a script
      • but it imports a django module (i.e. django.conf import settings)
      • when I run ./my_script.py
      • it complains no module named django.conf
      • running it with `python manage.py ...` works fine
      • but I need to run a scheduled job so that's not an option
      • what do I do?
      • rizumu has quit
      • mattmcc
        Set the DJANGO_SETTINGS_MODULE environment variable.
      • maxsong1002
        I tried this
      • APP_DIR = os.path.dirname(os.path.dirname(__file__)) sys.path.append(APP_DIR) os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
      • mmcardle joined the channel
      • rizumu joined the channel
      • FunkyBob
        PlasmaSheep: if it's static, how could it be a template? If it's static, don't waste resources asking Django to handle it
      • PlasmaSheep
        FunkyBob: static is maybe the wrong word; I just meant to say that it doesn't require special handling from a view
      • render does seem to work, thank you mattmcc
      • FunkyBob
        PlasmaSheep: every response in django is generated by a view (*)
      • (*) unless middleware takes over
      • PlasmaSheep
        I meant from a custom written view
      • FunkyBob
        render is a handy shortcut view
      • incitonetworks
        qq how do I override a form generated by the admin crud?
      • lduros joined the channel
      • FunkyBob
        incitonetworks: define the form on your admin class
      • incitonetworks: override in what ways?
      • mmcardle has quit
      • incitonetworks
        I want to have an additional form field which uploads a file in addition to the model fields for crud admin automatically generates. I want to process the upload separately and then save the crud part into the db
      • mykul joined the channel
      • notleigh has quit
      • FunkyBob
        this really sounds like you should be writing it as part of your own ap
      • app
      • maxsong1002
        FunkyBob: I want to run a script that contains `from django.conf import settings`. ./my_script.py returns "no module named django.confg"
      • FunkyBob: APP_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))); os.environ['DJANGO_SETTINGS_MODULE'] = APP_DIR doesn't help
      • incitonetworks
        can I write my own app and then have it included in the admin dashboard ?
      • FunkyBob: ^
      • FunkyBob
        maxsong1002: sounds like your virtualenv isn't activated
      • incitonetworks: why must it be in admin?
      • admin is NOT a console.. it's a DB admin tool
      • you shouldn't be using it as part of your app
      • napper has quit
      • napper joined the channel
      • dray3 has quit
      • incitonetworks
        you have a point its just that this bit of functionality will be used in conjunction with the admin tool to enter data into db
      • reason I need to do this is to associate a file uploaded to google app engine blobstore to a record in the db
      • FunkyBob
        is there some sort of GAE-specific custom field that works like ImageField, but stores in the "blobstore"?
      • Cromulent has quit
      • maxsong1002
        FunkyBob: virtualenv is activated. running `python my_script.py` works fine, but running `./my_script.py` gives "importError: no dmoule named django.conf"
      • FunkyBob
        what's the shebang line in my_script.py ?
      • hint: it's using the wrong python
      • maxsong1002
        ohhhh
      • sayan has quit
      • FunkyBob
        if it's not something like "#!/usr/bin/env python" ...
      • maxsong1002
        I'm doing this: #!/usr/bin/python
      • moneydouble joined the channel
      • I should make it address the python file inside my venv, right?
      • incitonetworks
        FunkyBob: not that I know of ! GAE procedure is to send the multiport form to a url you create with the GAE sdk then GAE will take file save it and replace file in request with a key and then it continues back to your django app to save the request in db
      • FunkyBob: see sample GAE app (not django)
      • FunkyBob
        incitonetworks: well, almost nobody here uses GAE... why did you choose GAE?
      • dray3 joined the channel
      • incitonetworks
        prototype for a client
      • FunkyBob
        Django just saves the relative filename to the DB, and saves the file through the storage engine
      • incitonetworks: and the client demanded GAE?
      • incitonetworks
        yes
      • FunkyBob
        maxsong1002: you should make it what I said
      • incitonetworks: with any justification?
      • did they also tell you what music you should listen to whilst you wrote it?
      • incitonetworks
        for the sake of prototype wants to see how well it works on there ! I was happy to do it as it would be good to know what is possible with GAAE
      • good for my resume :-)
      • FunkyBob
        quick, you'd better go learn ColFusion too...
      • mattmcc
        incitonetworks: Possibly worth testing: https://github.com/fhahn/django-gae-blobstorage
      • ehmatthes has quit
      • But me, I don't consider AppEngine terribly 'resume worthy'. It's just a black box, slightly incompatible with the world, extra-headaches environment.
      • FunkyBob
        mattmcc: heh.. now, why didn't incitonetworks go look for that when I suggested? :P
      • notleigh joined the channel
      • mishy has quit
      • incitonetworks
        mattmcc: thanks for that will have a look
      • FunkyBob: I did , for some reason didn't find it
      • FunkyBob
        incitonetworks: what matt said... GAE is an obscure tech that's not much used ... at least, not by anyone I know
      • we do get the occasional person fumbling with GAE in here... and are just as perplexed every time
      • incitonetworks
        guess its used more by java devs and google themselves
      • FunkyBob
        incitonetworks: did your client explain why they wanted you to use GAE?
      • perhaps their reasoning is faulty
      • incitonetworks
        in fairness to it now that they have mysql in cloud file uploads is the only issue with it
      • nope
      • mattmcc
        It's web scale!
      • FunkyBob
        incitonetworks: wait, you're listing MySQL as a _positive_?
      • incitonetworks
        yes scalability i guess also pay by hour
      • FunkyBob
        meh... every other PaaS has pay-by-the-hour scalability, too
      • culturelabs joined the channel
      • mattmcc
        You can get hourly metered hosting in any of a dozen other places that don't tie your hands.
      • FunkyBob
        why GAE?
      • incitonetworks
        FunkyBob: I agree its not a positive as I prefer postgres
      • rafales has quit
      • FunkyBob
        amazon now host postgres...
      • incitonetworks
        FunkyBob: I am saying its positive in the sense that before they had this to use django with gae you had to not use the wonderful django orm
      • moneydouble has quit
      • merlin83 joined the channel
      • FunkyBob
        and you still have to work with yet-another proprietary interface... for file storage
      • ehmatthes joined the channel
      • meanwhile... still wondering if you'll answer my question
      • incitonetworks
        mattmcc: thanks for earlier link ... not sure if it will work as it is meant for this custom version of django that I am not using
      • its not a positive but better than using GAE NDB
      • FunkyBob
        00:33 < FunkyBob> incitonetworks: did your client explain why they wanted you to use GAE?
      • incitonetworks
        no
      • FunkyBob
        ask them
      • incitonetworks
        will do
      • sentinal8473 has quit
      • MMcKay joined the channel
      • FunkyBob
        "Using GAE robs us of a lot of features, flexibility, and 3rd party tools... why are you so keen to use it?"
      • incitonetworks
        my guess is they use everything google
      • FunkyBob: not keen just giving it a go for client
      • mmcardle joined the channel
      • FunkyBob: I agree with all your points
      • FunkyBob
        incitonetworks: :no... that's the questin for your client
      • incitonetworks
        will find out one day
      • FunkyBob
        I was framing it for you so you could point out why they're possibly being stupid
      • maxsong1002
        FunkyBob: django.core.exceptions.ImproperlyConfigured: Requested setting GRAPH_DATA, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings
      • dray3 has quit
      • FunkyBob
      • maxsong1002
        FunkyBob: os.env['DJANGO_SETTINGS_MODULE'] = some_path will solve the problem?
      • FunkyBob
        maxsong1002: as the docs tell you, you must set that in your env [one way or another] to use django
      • incitonetworks
        FunkyBob: cool thanks
      • FunkyBob
        hmm... supposed to reach 28 today...
      • incitonetworks
        THeir compute engine actually looks good and competitive to aws
      • worth trying if more reliable than aws FunkyBob
      • WasabiFlipper joined the channel
      • FunkyBob: where are you located? 28 thats cold
      • PlasmaSheep
        28c is pretty warm
      • mattmcc
        Their pricing isn't remotely competitive with AWS, which has 1-year and 3-year reserved pricing.
      • FunkyBob
        incitonetworks: 28c... in my country, we use real metrics :)
      • that's over 82f
      • incitonetworks
        FunkyBob: ok then its nice and warm lucky
      • WasabiFlipper
        hi guys, I'm new to this. Which one should I learn, Django or rails?
      • incitonetworks
        Django of course
      • FunkyBob
        WasabiFlipper: do you know Python? do you know Ruby?
      • mmcardle has quit
      • PlasmaSheep
        ruby is for infidels
      • incitonetworks
        rails is so yesterday news