GrahamDumpleton: I saw a neat "callable class" method for decorators recently...
GrahamDumpleton
toll: If you are using mod_wsgi 3.4 and daemon mode, pointing at a virtualenv is as simply as adding python-home=/usr/src/ENV to the WSGIDaemonProcess directive.
toli: ^^^
A class with a __call__ method fails in lots of ways. I should remember to show that as a bad example.
Well, __call__ method alone.
It also need to have a __get__ method as well and do various other magic to work all properly.
GrahamDumpleton: I tested if I use daemon mod, and printed out: mod_wsgi.process_group = 'iget.be'
GrahamDumpleton
Am working on a decorator library that brings together all the magic I have worked out over the years.
seagreen joined the channel
toli
so it is process
enaut
Hey guys I'm still struggling with an app whose models can not be edited in django-admin when DEBUG=False! what could cause that behaviour? I have no custom has_*_permission defined... (I tried to define has_change_permission(): return True which didnt help)
GrahamDumpleton
toli: Good, so add python-home=/usr/src/ENV to the WSGIDaemonProcess directive.
That is, the value of sys.prefix for the virtualenv.
toli
GrahamDumpleton: to the httpd.conf ? or wsgi.py ?
GrahamDumpleton
To the WSGIDaemonProcess directive in the Apache configuration file.
FunkyBob
GrahamDumpleton: so it's basically "What I learned writing the Python client for NewRelic" ? :P
toli
ok
FunkyBob
GrahamDumpleton: can't wait to watch the video
GrahamDumpleton
FunkyBob: Sort of. I have worked out some nice tricks that have incorporated back quite yet.
You want to watch my monotone and heckle me.
FunkyBob
you know it! :P
toli
GrahamDumpleton: so in my config now I have : WSGIDaemonProcess iget.be display-name=%{GROUP} processes=1 threads=4 python-home=/usr/src/ENV
felix89 joined the channel
is that good
felix89 has quit
GrahamDumpleton
You can remove 'processes=1'. It defaults to one process and using the processes option even if for one process causes mod_wsgi to still flag it as a multi process configuration in WSGI environment, which will stop some WSGI web browser based debuggers from working. Esoteric technical detail, so just believe me and remove processes=1.
Otherwise looks good.
twoolie has quit
BTW, if only running the one WSGI application, also set WSGIApplicationGroup %{GLOBAL}
raijin has quit
Plus, at global scope in Apache config, outside of any VirtualHost, add WSGIRestrictEmbedded On.
That will turn of Python in Apache child process where you don't need them.
GrahamDumpleton: now I get again thiesame error ImportError: No module named django.core.wsgi
GrahamDumpleton
And Django is installed in the virtualenv and not separate as you had before. Is everything in the virtualenv readable to the user that your code runs as under Apache.
toli
GrahamDumpleton: is is still separate :)
GrahamDumpleton
pip install Django into the virtualenv.
toli
kk
nicklo joined the channel
GrahamDumpleton: I knew that is better to have the django package with your project, now it is piped in the ENV
GrahamDumpleton
FunkyBob: Me wonders if PyCon NZ will extend submission deadline. Cut off date supposed to be today, yet mine was proposal #16.
Never heard anyone suggest that Django itself should be a part of your project. Sounds like a really bad idea.
sidelil_ has quit
codeme joined the channel
toli
yes ?
rydgel joined the channel
tha guy who told me this, said that in this case your projects goes with the django version and there will be no confusions about it,
yesss
it works
yes
yes
omg GrahamDumpleton you are god
three days of head breaking
GrahamDumpleton
The only thing you should have with your projects is the pip requirements.txt file which lists the specific versions of packages you need to use. Then you build your virtualenv and go pip install -r requirements.txt.
johnraz has quit
FunkyBob
toli: this is why we use virtualenv and requirements.txt
GrahamDumpleton
That way only the package list needs to be with the project.
FunkyBob
and the right versions for it
GrahamDumpleton
If you aren't sure what is in the virtualenv, use pip freeze to generate the requirements.txt file.
toli
thanks
GrahamDumpleton
It will list exact versions.
liquid-silence joined the channel
lukaszb has quit
moneydouble joined the channel
toli
you are the man
Cromulent joined the channel
raijin joined the channel
culturelabs has quit
FunkyBob
well, he's the mod_wsgi man :P
toli
:p
GrahamDumpleton
A small hobby of mine. :-)
FunkyBob
heh
toli
now, when I try to open django admin, it says unable to open database file, and the path to the sqlite file is corect
toli: (a) is it a full path? (b) can the user mod_wsgi runs as write to the dir that the DB is in?
toli
hmm
FunkyBob
because sqlite needs to open another file there for its WAL/queue
toli
yes I have the full path
I will check the write access
FunkyBob
journal! that was the word I meant... not queue
m8 joined the channel
johnraz joined the channel
dali has quit
the_rat joined the channel
JainAmber
I want to add a profile_image column to Django's User model. Am I right that I should do this by extending the Django's User model (https://docs.djangoproject.com/en/1.5/topics/au...) with a column that is of ImageField type?
void has quit
FunkyBob
yes
JainAmber
ok
I asked to confirm because some old stackoverflow threads suggest using AUTH_PROFILE_MODULE but it seems that this was deprecated in Django 1.5. Thanks!
FunkyBob
don't believe what you read in SO
AUTO_PROFILE_MODULe was a neat tech demo, but IMHO never belonged in trunk
raijin has quit
GrahamDumpleton
SO is a bunch of wannabes who cut and paste other peoples answers.
All in the pursuit of gaming the SO score.
FunkyBob
where's the quality control? how do you know it's really a good answer, and not just a lot of people up-voting the same commonly learned mistake?
raijin joined the channel
the_rat has quit
arietis has quit
the_rat joined the channel
naquad has quit
naquad joined the channel
F1skr joined the channel
moneydouble joined the channel
JainAmber
Yes, I don't blindly believe SO answers. I trust only 1.5/dev documentation :)
the_rat has quit
the_rat joined the channel
SignorSasso
FunkyBob: i did it! now i'm cropping images like no tomorrow without problems!