|
hey, here's a conceptual question that's hopefully really obvious and dumb. I'm writing an app which is multiple todo lists, which is really just a toy app to get familiar with django If I want it so users can sign up, create/manage their own todo lists (creating/deleting lists, adding/removing items, etc), it seems like the pre built admin stuff can do a lot of this already. Should I just be making some custom view over the existing admin functionality? Or should I be doing my own views/form objects etc
|
# ? May 3, 2010 17:33 |
|
|
# ? May 31, 2024 22:01 |
|
unixbeard posted:it seems like the pre built admin stuff can do a lot of this already. Should I just be making some custom view over the existing admin functionality? unixbeard posted:Or should I be doing my own views/form objects etc
|
# ? May 3, 2010 17:37 |
|
Yay posted:Yes. Its not hard, and you may be one of those who can get by using the generic objects for CRUD. yeah I have a feeling I can. Maybe I missed it in the docs but do the generics come with crud operations or do you have to write your own? The generic views page seems to only cover views, and the tutorial keeps the vote handler in urls.py when it gets to generics
|
# ? May 3, 2010 17:59 |
|
ok i just found the crud objects in the docs, thanks for your help
|
# ? May 3, 2010 18:09 |
|
it doesnt seem to be working, the form displays and i can post etc but the data isn't being stored, what am i missing here? pre:(r'^new/$', 'django.views.generic.create_update.create_object', dict(model=TodoList)), <form action="" method="post"> <p>{{ form.title.label_tag }} {{ form.title}}</p> <input type="submit" value="create"> </form> <p><a href="/todo/">Back</a>
|
# ? May 3, 2010 19:45 |
|
so it was a problem with my model, learning new frameworks
|
# ? May 3, 2010 20:24 |
|
What hosting servies do you guys use/recommend? I am a few months away from deploying a decent sized Django application, and this will be my first time doing anything serious with Django. Does anyone have good experiences with Mediatemple? They are the supposed official django hosts, says some list I found somewhere.
|
# ? May 4, 2010 02:59 |
|
I'm doing something wrong:The Error posted:TemplateSyntaxError: Caught TypeError while rendering: unpack non-sequence It's dying when (I think) trying to display a MultipleChoiceField. Here's my form: code:
code:
|
# ? May 4, 2010 03:05 |
|
Escher posted:What hosting servies do you guys use/recommend? I am a few months away from deploying a decent sized Django application, and this will be my first time doing anything serious with Django. Either webfaction for small things or a VPS for larger things (either Rackspace Cloud or Slicehost)
|
# ? May 4, 2010 03:45 |
|
Doh004 posted:I'm doing something wrong: Do you have the html form tags (http://w3schools.com/tags/tag_form.asp)? If you do, ignore this entire post. I'm worthless. code:
|
# ? May 4, 2010 04:06 |
|
Doh004 posted:
Try: code:
|
# ? May 4, 2010 04:33 |
|
spencer for hire posted:Do you have the html form tags (http://w3schools.com/tags/tag_form.asp)? If you do, ignore this entire post. I'm worthless. Lamacq posted:Try: Same error as before *edit* Got it fixed! Turns out I had left an old line of code from one of my many changes when trying to get it working. Thanks guys Doh004 fucked around with this message at 05:16 on May 4, 2010 |
# ? May 4, 2010 05:11 |
|
Escher posted:What hosting servies do you guys use/recommend? I am a few months away from deploying a decent sized Django application, and this will be my first time doing anything serious with Django. Have not had good luck with MT, actually. Slicehost and Linode are both awesome to use, though.
|
# ? May 4, 2010 14:07 |
|
Escher posted:What hosting servies do you guys use/recommend? I am a few months away from deploying a decent sized Django application, and this will be my first time doing anything serious with Django.
|
# ? May 4, 2010 14:32 |
|
geera posted:I haven't used them personally, but I've read good things about WebFaction's Django hosting. I'm also going to recommend these guys. Last year when I was looking for an easy Django hosting solution they were the only decent ones. They actually give you shell access which was a first time for me on a shared hosting.
|
# ? May 4, 2010 18:34 |
|
Trying to set up flowplayer using django-flowplayer, run into this problem while testing:code:
|
# ? May 6, 2010 06:57 |
|
I think it's trying to grab http://localhost:8000/home/****/... which is why it's coming up 404. You need to look through whatever settings flowplayer is using to serve local media. MEDIA_PATH or MEDIA_URL, perhaps.
|
# ? May 6, 2010 07:03 |
|
nbv4 posted:I'm pretty sure the problem is with mod_wsgi. In my apache logs, I see the error "premature end of script headers", which is coming from mod_wsgi around the same time apache crashes. It's hard to debug because crashes only happen once every 8 days or so. if you still run into this problem, are you also logging flup? We had an issue where several of our sites were mysteriously dying, no errors in any logs except from lighttpd saying "unexpected EOF, nothing on the socket" or something similar. Turns out we were using cmemcache instead of python-memcache (a recommendation in the django docs ) and cmemcache is not threadsafe. It was throwing errors that weren't being caught, and they'd propagate all the way up and kill the thread. I figured it out, only after starting the process like this: code:
|
# ? May 8, 2010 23:13 |
|
multigl posted:Turns out we were using cmemcache instead of python-memcache (a recommendation in the django docs ) and cmemcache is not threadsafe. It was throwing errors that weren't being caught, and they'd propagate all the way up and kill the thread. I noticed several errors in the logs once I upgraded mod_wsgi of failures of memcached. I switched from cmemcache to python-memcache and that seems to have fixed a lot/all of the errors. I don't know if it was a combo or not, though, and I don't really care to test it.
|
# ? May 9, 2010 03:09 |
|
For the record the docs no longer recommend cmemcached, in 1.3 pylibmc will become the reccomended memcached lib.
|
# ? May 9, 2010 03:35 |
|
speaking of pylibmc, has anyone here ever managed to get it working in ubuntu? iirc, pylibmc requires libmemcache 0.32 or greater, yet lucid only includes 0.31. I manually built the latest version (0.38 I think), but ended up with this: http://stackoverflow.com/questions/2612515/pylibmc-undefined-symbol-memcached-server-list Also, when I was using the filesystem cache backend, the cache directory seemed to never go above about 8 MB. I'm assuming django deleted the cache data after it expired. Now that I've switched to memcache, the cache seems to just fill up to the capacity limit and stay there. Is that normal or a sign that something is not right?
|
# ? May 9, 2010 06:31 |
|
Don't use file based caches. Just don't.
|
# ? May 9, 2010 06:41 |
|
king_kilr posted:Don't use file based caches. Just don't. why not? I'm actually thinking of dumping memcache and going back to the file cache at least until my site grows a little more. Memcache uses memory which for me is in short supply, and the file cache performs just as well. For reference, my site gets about 2 access per second during peak times.
|
# ? May 9, 2010 07:34 |
|
nbv4 posted:why not? I'm actually thinking of dumping memcache and going back to the file cache at least until my site grows a little more. Memcache uses memory which for me is in short supply, and the file cache performs just as well. For reference, my site gets about 2 access per second during peak times. Generally because web applications are io bound and pushing something that is supposed to alleviate io latencies onto io isn't the best solution. I don't think it's awful though, using file based caching with django is a known quantity and if it performs well & better than no caching, then why not?
|
# ? May 9, 2010 20:44 |
|
I'm using generic views and I'm trying to get_absolute_url to work, but I'm having a problem because I think one of my values I'm passing for the url is a manytomany. Code: code:
code:
|
# ? May 10, 2010 00:27 |
|
when you do self.series what comes out? I'm guessing it's something that doesn't match [-\w]+ in your url
|
# ? May 10, 2010 06:00 |
|
nbv4 posted:why not? I'm actually thinking of dumping memcache and going back to the file cache at least until my site grows a little more. Memcache uses memory which for me is in short supply, and the file cache performs just as well. For reference, my site gets about 2 access per second during peak times. Contrary to popular belief, rdbms are not that slow, specially for indexed key/value storage (where the queries will be easily cached). The DB backend is probably going to be faster, more thread-safe and less io intensive than file caching.
|
# ? May 10, 2010 16:13 |
|
nbv4 posted:when you do self.series what comes out? I'm guessing it's something that doesn't match [-\w]+ in your url My regex skills is near zero, whats the best way to come up with them? The url will be something like videos/random-series/random-video
|
# ? May 10, 2010 21:29 |
|
I'm having a problem with Django spitting blood about an underlying MySQL view. I have a MySQL view that looks like this: code:
code:
Occasionally and very randomly the app crashes with the same bug, despite the fact that the table/view in question isn't used at all, nor is there a schema in models.py for it. Very loving annoying. This , by the way, is why magic is bad for frameworks. Any solutions? edit: seems like changing the string "addition" to a CONCAT() does the trick, but I still dont understand why Django cares about the views. Not for you Django! duck monster fucked around with this message at 04:58 on May 11, 2010 |
# ? May 11, 2010 04:50 |
|
I would guess that it just does code:
Edit: specifically, its used here without any filtering. It may be intentional (because django can make use of views if they're marked unmanaged in the models), but should maybe be filtered for inspectdb? I'm not sure whether the problem is local to you and your view (after all, concat fixed it) or in how django's parsing that. There's nothing currently listed regarding it, so if you can make a reproducible case, I'd file a ticket. Yay fucked around with this message at 10:44 on May 11, 2010 |
# ? May 11, 2010 10:34 |
|
LuckySevens posted:I'm using generic views and I'm trying to get_absolute_url to work, but I'm having a problem because I think one of my values I'm passing for the url is a manytomany. Try passing it a string instead of "self.series" which you said is a ManyToMany field. Decorators are neat too. code:
code:
|
# ? May 11, 2010 15:16 |
|
I've been playing with Django for a few hours and I guess I am still trying to wrap my brain around the many-to-many relationship and whether I really need it just to create a widget that display a multiple choice field. I don't mind overridding the admin models in admin.py, but I still can't seem to get a real, multiple choice, form to work properly. Does anyone know of a little walkthrough or some kind of pre-built example that can get me over this first hump of understanding?
|
# ? May 11, 2010 18:14 |
|
inveratulo posted:I still can't seem to get a real, multiple choice, form to work properly. I'm assuming the common pitfall here, so if thats not the problem you're having, can you explain the problem in a more expansive way? Not being able to wrap your head around the idea of various relationships isn't the easiest thing to rubberduck. (Edit: are you having trouble with the idea of M2M, or with forms, or ModelForms, or ModelAdmins?) Yay fucked around with this message at 19:47 on May 11, 2010 |
# ? May 11, 2010 19:43 |
|
Yay posted:If you've got a multiple choice field (select, checkbox etc), the resulting key in request.POST/GET will be a querydict. IIRC, printed to stdout, or into a template, it always displays the first (or is it last?) one selected, giving the appearance that its not working—It comes up on #django IRC all the time—even though if iterated over, all the values are there. I guess I set out to make a scheduling app for watching automated jobs. I was going to use Chronograph but it has too many features and I would just rather learn how to do all this myself anyway, because it would have to be heavily retooled anyway. The idea was to have a field where one can select multiple months, or days, or whatever the repeat interval (think of it in terms of cron jobs that run in regular intervals). So, I am trying to override the admin models and create multiple select checkboxes, but I have not been able to make it work. The Django admin page just ignores all of my models if something has gone wrong.
|
# ? May 11, 2010 20:14 |
|
inveratulo posted:I guess I set out to make a scheduling app for watching automated jobs. I was going to use Chronograph but it has too many features and I would just rather learn how to do all this myself anyway, because it would have to be heavily retooled anyway. The idea was to have a field where one can select multiple months, or days, or whatever the repeat interval (think of it in terms of cron jobs that run in regular intervals). So, I am trying to override the admin models and create multiple select checkboxes, but I have not been able to make it work. The Django admin page just ignores all of my models if something has gone wrong. At its simplest, you wouldn't require any relationship—handling the idea of something that occurs at N steps only requires two fields: code:
If, for example, you wanted a Job to be able to run at multiple times, I'd create Job class, which has inlines (generic or FK'd) of Schedule objects.
|
# ? May 11, 2010 20:53 |
|
Yay posted:At its simplest, you wouldn't require any relationship—handling the idea of something that occurs at N steps only requires two fields: This is really a better way of thinking about things than how I was going about it. But it still doesn't address the edge cases of say when I want a job to run daily, except on Sundays.
|
# ? May 12, 2010 18:06 |
|
Something I'm missing here, I'm trying to use a generic view to display a list of a certain value in my database, but from what I'm reading to do this, it needs to be a primary key/slug? The url works fine when its a slug, but is there a way to do it if its a non-primary key value, or do I have to write a view?
|
# ? May 12, 2010 23:28 |
|
LuckySevens posted:Something I'm missing here, I'm trying to use a generic view to display a list of a certain value in my database, but from what I'm reading to do this, it needs to be a primary key/slug? The url works fine when its a slug, but is there a way to do it if its a non-primary key value, or do I have to write a view? If you spend more than about 10 seconds thinking about it just write a real view. They aren't that much work.
|
# ? May 13, 2010 02:00 |
|
Yeah, I just wrote the view myself, everything works smoothly now except:code:
|
# ? May 13, 2010 07:09 |
|
|
# ? May 31, 2024 22:01 |
|
What you're missing is that you have multiple VidSeries for a given self, how do you know which slug, from all of those, you want?
|
# ? May 13, 2010 07:38 |