#django

/

      • joshuajonah
        iGeni: Please provide code and __full__ traceback in a pastebin
      • codeme_ joined the channel
      • tbaxter
        persina: not really. Are you talking about wsgi.py?
      • codeme has quit
      • codeme_ is now known as codeme
      • mtj__ has quit
      • persina
        tbaxter: httpd.conf
      • joshuajonah
        persina: I have about 20 conf files in my projects, an nginx one, a uwsgi one, a wsgi one, etc.
      • tbaxter
        httpd.conf?
      • iGeni
        i dont have a trace yet, it happends in this form https://dpaste.de/bXBR
      • let me trigger a trace local
      • tbaxter
        Sorry, I don’t think I have an httpd.conf file. maybe in my old apache setup, but i’d have to really really dig.
      • joshuajonah
        Sounds like a problem you should have automatically handled in settings.py
      • areski joined the channel
      • persina
        tbaxter: the file that tells wsgi where to look
      • tbaxter: where you define WSGIScriptAlias and the directory directives
      • tbaxter
        sorry, I turned my back on apache awhile back.
      • persina
        as explained in the python apache deployment
      • joshuajonah
        Most python people did a while ago.
      • garrypolley has quit
      • persina
        tbaxter: what is the alternative to mod_wsgi?
      • rpkilby joined the channel
      • tbaxter
        I’m partial to nginx+uwsgi, myself. Others like gunicorn. Others have other setups.
      • csotelo has quit
      • joshuajonah
        iGeni: Then wait till you have the traceback, your original statement doesn't give enough info to help you.
      • iGeni
        k
      • tbaxter
        Even when I DID use apache, though, I don’t recall setting any paths more than once.
      • persina
        tbaxter: yes, you set it once. But then you have to prepend the BASE_DIR to every path in your program.
      • tbaxter
        “you have to prepend the BASE_DIR to every path in your program.” <== this is the part that makes not sense.
      • joshuajonah
        persina: Give us an example of the many paths in your program.
      • cssko joined the channel
      • persina
        tbaxter: straight from the documentation "# Build paths inside the project like this: os.path.join(BASE_DIR, ...)"
      • rpkilby has quit
      • joshuajonah: any file i/o operations
      • joshuajonah
        All i tend to use is MEDIA_ROOT, STATIC_ROOT, and template directory
      • thats three times I have to use a predefined variable, that's not out of hand.
      • tbaxter
        persina: like joshuajonah said, show us where you’re having to use BASE_DIR
      • sanketdg has quit
      • iGeni
      • name_map = self._meta.init_name_map()
      • persina
        tbaxter: example : open(BASE_DIR + '.../.../.../progress.txt', 'w')
      • tbaxter
        what the everloving hell is that
      • persina
        tbaxter: like I said, any io operations
      • joshuajonah
        persina, how often are you opening local files in your project?
      • eefvx joined the channel
      • persina
        joshuajonah: often. I'm logging stuff, reading files, writting files, etc.
      • tbaxter
        I smell a mess.
      • `nik`
        here is my form with my MultiValueField - http://dpaste.com/20NEB1Z - it's working, but the labels I'm specifying with IntegerField aren't showing up. if anyone sees any obvious problems with the code let me know.
      • joshuajonah
        lol
      • v0lksman
        why doesn't my mock override the views calls to get_filesize (only one I'm testing right now) https://dpaste.de/v1P6
      • I'm basically expecting that size = '13k' in the view
      • persina
        tbaxter: why?
      • iGeni
        the code where it occurs https://dpaste.de/7r77
      • tbaxter
        You’re asking why I smell a mess?
      • grafa joined the channel
      • codeme has quit
      • Debnet joined the channel
      • persina
        tbaxter: yea, i have a solution. I'll just add the paths to settings.py so i only have to open(PROGRESS_FILE)
      • iGeni
        did something change in name_map = self._meta._name_map / name_map = self._meta.init_name_map() in 1.8.5
      • grafa has quit
      • tbaxter
        persina: because first, Django handles most IO operations for you, if you let it. ANd logging, too. Second, the way you’re doing that is horribly fragile and will never survive any filesystem change. Third, the existince of progress.txt looks like a wild perversion o the templating system.
      • joshuajonah
        persina: That sounds more sane
      • tbaxter
        agreed
      • iGeni
        it says 'Options' object has no attribute 'init_name_map'
      • joshuajonah
        Or a wild perversion of an anyalytics system
      • \/auditing
      • Melamo joined the channel
      • iGeni: Well, go into the django codebase and see if that exists.
      • It is the best documentationa fter all.
      • persina
        tbaxter: I can just change the paths in settings.py in the case of a file system change. progress.txt is not a template, it is created and then displayed to the client
      • joshuajonah
        `nik`: I'm trying to figure this out for you. Just looking at django's code base to see where it creates the html for this field.
      • persina
        i guess i could make it a template...
      • joshuajonah
        persina: For what purpose is this written tot he file ssytem and shown to the user?
      • persina
        joshuajonah: its written, saved in a /progress directory and then shown to the user upon redirect
      • sheshkovsky has quit
      • joshuajonah
        iGeni: You still haven't sent an actual traceback, you just copy and pasted the debug page.
      • persina: WHY?
      • Are you saving cookie recepies? Is this a hit list of vegans? whay?
      • persina
        joshuajonah: so the user can view the progress file which explains what happened in the computation
      • joshuajonah: it's also queried via ajax during the computation
      • joshuajonah
        Whatever, either way, this sounds like a TextField in the database.
      • persina
        joshuajonah: no access to a database
      • joshuajonah smashes face on keyboard
      • brat197 joined the channel
      • youngbaks joined the channel
      • joshuajonah
        So you're using the filesystem as a half ass database.
      • I guess there's merit to that
      • persina
        joshuajonah: and anyways, i don't need a whole database for a tmp file that gets rewritten every time.
      • joshuajonah
        Except it's about 5345345343534 times faster than file i/o
      • Itkovian joined the channel
      • If it's always rewritten, i would even use a cache
      • persina
        joshuajonah: the txt file has max 30 lines, efficiency isn't really a problem.
      • v0lksman
        yay
      • persina
        joshuajonah: no point in caching 30 lines of txt..
      • joshuajonah goes outside to smoke furiously.
      • garrypolley joined the channel
      • joshuajonah: and the majority of the file is different upon each run
      • tbaxter
        shit, you can do a progress bar with nothing more than an integer and some css
      • persina
        tbaxter: its a more detailed progress bar :P
      • rpkilby joined the channel
      • joshuajonah
        Why do you not have a database? is this some sort of embedded system?
      • anth0ny joined the channel
      • Poulet joined the channel
      • bender314 has quit
      • transit joined the channel
      • SteenJobs has quit
      • mehola joined the channel
      • flobin has quit
      • byoungb has quit
      • Melamo has quit
      • mehola has quit
      • krawchyk has quit
      • transit has quit
      • ikerDePount joined the channel
      • cocteau joined the channel
      • edgabaldi has quit
      • Nizumzen has quit
      • transit joined the channel
      • rpkilby has quit
      • APXtvlKDVI joined the channel
      • Coldblackice joined the channel
      • APXtvlKDVI
        Can a template have multiple {% extends %} tags?
      • mburke05 has quit
      • joshuajonah
        APXtvlKDVI: no, how would you even expectthat to work?
      • v0lksman
        APXtvlKDVI: no but you can use {% includes %}
      • tbaxter
        no. it sounds like you’re not using blocks well.
      • solidvance has quit
      • v0lksman
        or that :)
      • APXtvlKDVI
        Oh yeah, I can see why that wouldn't work. I'm trying to have a "sub-template" that fits into several templates' {% block %}{% endblock %} tags, but I'm not sure how to do that.
      • brat197 has quit
      • Like the inverse of the typical case where you have a base template and several child templates.
      • tbaxter
        sub template usually means poor inheritance. You CAN use include, but usually shouldn’t.
      • nirakara has quit
      • but sometimes, include is the thing. it’s there for a reason.
      • I’m a big fan of inclusion tags, too
      • v0lksman
        APXtvlKDVI: sounds like you want your app to extend base_app.html which in turn extends base.html
      • tbaxter
        that’s a super common pattern I use all the time.
      • msg555 has quit
      • APXtvlKDVI
        Well, what I'm trying to do is...I have several templates that have a form, and instead of writing out the same form crap with {% if %} and {% for %} tags and whatnot, I wanted to replace them all with {% block %} tags and have a single forms.html or something that gets plugged into those templates.
      • v0lksman
        include
      • APXtvlKDVI
        Oh
      • I didn't know that was a thing.
      • keimlink has quit
      • v0lksman
        {% include 'form.html' %} something along that line
      • APXtvlKDVI
        Thanks!
      • tbaxter
        actually, I’m thinking inclusion tag, jsut so you can get the form class and insert it into the current context.
      • CrypticSquared has quit
      • v0lksman
        however you may need to use an inclusion tag if you need some logic around it
      • tbaxter
        and not have to do it in the view.
      • CrypticSquared joined the channel