Hi everyone. If I get a list of players and do .select_related('club') then while I loop through players, if I change a status of a club then the consequent iterations won't know about the change. How can this be solved?
Hey guys! So… I was looking at using different databases within my project. I will have multiple users using my app, and each user will be part of a company. I want each company to have its own database. Now, what would be the easiest way in Django whenever I make my queries to use the appropriate DB in question?
This is an example that I just came up with, but it relays the point
club.notify() is supposed to be called only once per club
but if I use .select_related() it gets called as many times as there are players in that club
tbaxter
abisson: watch out for foreign keys. I don't know if I would do what you're doing. I would probably use the sites framework and restrict company to the current site, if I were you
abisson
tbaxter: what do you mean?
cewing is now known as cewing|afk
bvlaar joined the channel
Nemo7 has quit
Linovia
or use a multitenant app with a one db per tenant
xeberdee
If I can run django-admin.py without 'python' first - then I have the correct path in my syspath? I changed my syspath to include the path to django-admin.py - the only result virtualenv does not work anymore :)
Linovia
abisson: you don't do FK across databases
abisson
Linovia: I know… and their won't be
siminm has quit
For example… I just want company_1_db, company_2_db, company_3_db… and each user connected to the site use the appropriate DB, depending on which company they are from
tdelam joined the channel
tbaxter
I think I would have company == site, then everything is keyed to current site
abisson
drewtemp: I saw that… but the example is more like "The User Model" use this DB… this model use This DB…. I want more like I said in the previous line
deuterium joined the channel
tbaxter
Or, set up a crapload of projects, one for each company, using shared apps
abisson
tbaxter: if I use AWS and EC2… that means one EC2 per company?
fpk^away is now known as flashingpumpkin
michaelfillier has left the channel
flashingpumpkin is now known as fpk^away
ok forget Amazon… if it was a normal server, (noob question), how can I host multiple sites on the same physical server?
Django (obv)
Unifox joined the channel
xeberdee has left the channel
regebro has left the channel
Linovia
abisson: sure
uris joined the channel
drag0nius joined the channel
drag0nius
anyone used django-cron recently?
abisson
Linovia: not sure what you are agreeing on :P
drag0nius
those imports on default page are invalid
bricker`work joined the channel
Linovia
abisson: "if it was a normal server, (noob question), how can I host multiple sites on the same physical server?"
bricker`work
Are there any app-level concerns I should consider when switching all of the mysql tables from MyISAM to InnoDB?
apollo13
stuff might break
bricker`work
apollo13: any specific examples?
rogi has quit
apollo13
bricker`work: like the migration will fail cause you can already have borked data in MyISAM
abisson
Linovia: so… should one one server hosts multiple django sites? Each with its own database?
bricker`work is now known as bricker
starsinmypockets joined the channel
bricker
apollo13: I wonder if there's a way to have innoDB check and report any broken key constraints
apollo13
innodb does check constraints
starsinmypockets
If I want to check for the existence of requet.POST['foo'] do I have to do it in try/except block to be safe?
Linovia
what's a one one server ?
apollo13
but hey, if you switch off from myisam just switch to postgres
starsinmypockets: if 'foo' in request.POST
starsinmypockets
ok tx
bricker
apollo13: I mean check the data integrity all at once, rather than have someone run into an error on some old record
rogi joined the channel
brainwarped has left the channel
apollo13
bricker: well yes it will cry loudly during import
you can't just "switch" the engine anyways
d0c0nnor has quit
you'll need dump+restore
jderosa has quit
Tom234 joined the channel
bricker
apollo13: alter table posts engine=InnoDB; ?
apollo13
I am surprised
stemid joined the channel
that will take long though^^
bricker
apollo13: about a minute according to my test
stemid
what if I want a field called 'type' in my db model?
bricker
probably a little longer on the production server
apollo13
bricker: oh, you should have said you have no data in it…
bricker
apollo13: there is lots of data in it :)
stemid
nevermind, someone already asked it on SO and they said you should just rename the variable.
cd75
stemid: yeah, exactly. rename it. Don't use reserved terms for fields. It's painful.
abisson_ joined the channel
setmeaway joined the channel
mattions has quit
stemid
I will, but imo, since sql queries can quote reserved names, django should be able to create models in a similar way. but a lot of things should a lot of stuff so it doesn't really matter.
apollo13
bricker: if it does that in one minute? either that is a noop or it's not much data
abisson_ has quit
abisson has quit
bricker: docs talk about hours for a rollback if an error occurs