#django

March 10th, 2010

02:18 monokrome
Anyway, I don't think there is anything "wrong" with that really. But saiyr said that using a domain as a base package provided no benefit.
02:19 bencc
gurft: you need to make sure that the db structure of the raw SQL match the db structure built with syncdb
02:19 monokrome
I've only ran into a name collision issue once, and it could have certainly been avoided. However, the possibility existing is what brings me to that type of organization.
02:20 monokrome
Even if they are stored in me.monokro.package format, that doesn't even really mean they have to be imported that way. Also, mattmcc - do you use virtualenv on production servers? I haven't looked into using it yet, although I do intend on it.
02:20 mattmcc
Yep.
02:21 monokrome
hmm
02:21 mattmcc
mod_wsgi makes it pretty dead simple.
02:21 monokrome
That could actually solve an issue I've run into.
02:21 bencc
is it possible to group model objects by some field and then group each result again by another field?
02:22 mattmcc
And since we have different clients on different Django versions, not using virtualenv would make the web server config somewhat more of a headache.
02:22 bencc
I can group by the first field and then I'm stuck http://dpaste.com/170239/
02:23 monokrome
mattmcc: Yep. Plus, my webapps are hosted on Amazon EC2 - so I'm always afraid of the server crashing because it resets the entire hard disk to base install upon rebooting the servers.
02:23 mattmcc
Well, that's what EBS is for.
02:23 monokrome
I have a script that reconfigures the system to solve that, but it's a pain.
02:23 monokrome
Yes, I have all of the apps and templates on EBS
02:23 mattmcc
And you can make your own AMI of your server config.
02:23 mattmcc
Should never have to reconfigure an image.. :)
02:24 BlueSilver39
is it best to use model form when you can?
02:24 BlueSilver39
or just use Forms?
02:24 monokrome
Yes. I know that, but I didn't want to delve into that process until I figured out how to minimize the need to change the AMI... Virtualenv seems like the perfect answer.
02:24 mattmcc
There's an option to have an instance use EBS for the root filesystem, iirc, but we haven't looked into that.
02:24 monokrome
BlueSilver39: When you can use ModelForm easily, use it.
02:24 bencc
BlueSilver39: use ModelForm if you can.
02:24 BlueSilver39
ok
02:24 monokrome
I've wondered about that, mattmcc. That would be nice.
02:24 BlueSilver39 is still trying to get good practices down
02:26 mattmcc
Linode's stack scripts are pretty cool too.
02:27 mattmcc
The gap between EC2's 'cloudness' and that of VPSs with APIs like Linode and Slicehost seems to be closing over time.
02:28 oliland
i never really know what to do with VPS databases
02:28 oliland
anyone ever clustered postgres?
02:31 monokrome
Hmm. I haven't looked into that, mattmcc.
02:31 bwooceli
so i had this great idea to leverage django in a statistical analysis project, it's working amazingly well. only issue, is when i have to import my data, as I load sourcefiles (alot of them, and with a combined count of > 200k) memory usage baloons out of control. seems like objects aren't being released when I'm done with them. can someone point me to anything on memory managemnt with django? or is that out of scope...
02:32 mattmcc
bwooceli: As soon as you say 'statistical analysis' I would say 'stop using models'.
02:32 monokrome
Python generally handles memory management...
02:32 atoi
if I have a ForeignKey on Users and a ManyToManyField on Site in a model... I wonder if I can class Meta: unique_together=('user', 'sites')
02:33 mattmcc
DBs (Well, postgres and oracle) are very good at doing complex math on their data.
02:33 FunkyBob
oliland: there are a couple of clustering tools for pg
02:33 monokrome
mattmcc: Model data is fine for a base dataset for statistical analysis
02:33 mattmcc
I'd move it all into stored functions.
02:33 bwooceli
mattmcc: lol i know. but once the data's in there, it really works well.
02:33 atoi
"easy" sometimes isn't a good enough excuse to do something.
02:34 bwooceli
really the dataload is the only time i run into problems
02:35 bwooceli
i'm using csv to read data into a temporary model, then i have a method that takes the temp entry, cleans up some of the fields, sets it to a new model instance, saves and returns.
02:36 bwooceli
but it's like the method just leaves the model instance just hanging there, and after 200k+ rows, it dies and i have to restart (picking up where it left off)
02:36 mattmcc
Do you have DEBUG on?
02:36 bwooceli
mattmc: erm, yes
02:36 mattmcc
Turning that off is a good first step.
02:39 bwooceli
mattmc: oy. trying it now. my shell instance took up a benchmark size of ~12M, and would baloon to 500M after loading a few files. it's now expanding at a rate of about 200K per file loaded.
02:39 bwooceli
gdam it's always something simple like that.
02:40 mattmcc
With DEBUG on, every query is added to a list (connection.queries)
02:40 mattmcc
So while turning it off isn't a silver bullet, it'll certainly take a chunk out of the problem.
02:41 bwooceli buys the house a round.
02:44 bwooceli
not that it's news to anyone here, but django is unbelievably useful. i'm an analyst, but this is letting me build an enterprise class tool in an amazingly short time. take that .NET
02:45 mattmcc
Heh. My friend who wears a variety of Oracle hats (analytics, ETL, architecture..) likes Django, but for analysis/reporting, he sees it simply as a UI tool that presents the data crunched by his Oracle package.
02:46 FunkyBob
bwooceli: you're right, it's not news to us... but we do derive pleasure from your joy :)
02:46 bwooceli
i'm using it to build a reporting tool
02:46 mattmcc
Where my UI gives him parameters, he runs a function, and I get a big DBMS_OUTPUT blob to play with.
02:46 FunkyBob
mattmcc: makes sense
02:47 mattmcc
It's analogous to why geodjango exists. It'd be silly to write all the Python code to do at the application level what postgis does at the DB level.
02:47 friskd
.
02:48 mattmcc
On the other hand, there's plenty of stuff scipy can do much easier than most DB libraries offer.
02:50 bwooceli
yeah i'm using pygsl
02:52 warz
im a little confused by django.contrib.gis - is this the same as geodjango?
02:52 mattmcc
Yes.
02:52 warz
so, geodjango.org docs which say to import geodjango can be substituted with contrib.gis?
03:00 monokrome
warz: I'd assume as much. I don't even have a module called Geodjango
03:00 monokrome
ImportError: No module named geodjango
03:01 subsume
Can someone bail me out of a situation? Error overriding the Comments model default manager.
03:01 monokrome
Does the comments app have a custom manager?
03:02 subsume
hmm
03:02 subsume
good question
03:02 monokrome
yep
03:02 subsume
the error itself is a rather basic one tho
03:02 subsume
self.model == None
03:02 monokrome
Try extending django.contrib.comments.managers.: 252 seconds]
03:02 monokrome
20:00 -!- PPeeps [~Owner@2001:470:1:b8:20c:29ff:fe32:c286] has joined #django
03:02 monokrome
Try extending django.contrib.comments.managers.CommentManager
03:02 monokrome
Sorry, bad paste.
03:02 subsume
kk
03:04 monokrome
What was the error?
03:05 subsume
Oh crap I just realized the problem
03:05 PPeeps
Have a friend looking to fill some positions for bay area located devs experienced with python/django/jquery/mysql, PM me if interested or know of anyone thats looking
03:06 subsume
PPeeps: you need a cam guy?
03:06 PPeeps
cam?
03:06 subsume
yeah, you know. like live cams. sex shows. etc.
03:06 monokrome
Is pythonw.exe the standard name of Python for Windows' executable?
03:06 PPeeps
subsume: na, well maybe..... haha no
03:06 subsume
monokrome: apparently the problem is I'm an idiot and for some reason thought it was a good idea to explicitly set Comment.objects. lol.
03:07 subsume
PPeeps: oooh django. right.
03:07 subsume
sorry
03:08 PPeeps
haha no problem, its not even actually me looking. they just were having trouble getting qualified devs for the position
03:10 subsume
weird.
03:10 subsume
what's qualified?
03:10 subsume
PPeeps: ^^
03:10 PPeeps
i'm not sure exactly, just from what i heard they were lackluster
03:10 PPeeps
thats all
03:11 subsume
PPeeps: righton. what is the going rate for a djangonaut out there?
03:12 PPeeps
i'm not sure, i could ask tho
03:13 subsume
PPeeps: what kinda firm is doing it? some ecommerce stuff?
03:23 PPeeps
subsume: one sec