Greg’s Comments on the Internet – Greg Allard http://gregallard.com The portfolio of the web developer. Fri, 11 Sep 2009 00:41:59 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.15 How to Display Realtime Traffic Analytics http://gregallard.com/how-to-display-realtime-traffic-analytics-3/ Wed, 02 Sep 2009 20:50:50 +0000 I left that out of the post because I didn't change it from what Apache was installed with on my debian box. It looks like this.

#

# The following directives define some format nicknames for use with

# a CustomLog directive (see below).

# If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i

#LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t \"%r\" %>s %b" common

LogFormat "%{Referer}i -> %U" referer

LogFormat "%{User-agent}i" agent

Format reference: http://httpd.apache.org/docs/1.3/mod/mod_log_config.html#for...

Read more comments by Greg Allard

]]>
Conditions on Count or Sum in MySQL http://gregallard.com/conditions-on-count-or-sum-in-mysql/ Fri, 28 Aug 2009 20:31:01 +0000 yeah that looks like it should work

Read more comments by Greg Allard

]]>
Xapian-haystack – A Xapian backend for Django Haystack http://gregallard.com/xapian-haystack-a-xapian-backend-for-django-haystack/ Tue, 11 Aug 2009 15:23:03 +0000 I was using haystack with whoosh and running into the same problem. I was waiting for some updates on that, but I think I'll check this out first. Thanks for sharing the code.

Read more comments by Greg Allard

]]>
A Django Model Manager for Soft Deleting Records and How to Customize the Django Admin http://gregallard.com/a-django-model-manager-for-soft-deleting-records-and-how-to-customize-the-django-admin-7/ Mon, 10 Aug 2009 14:46:43 +0000 That would work. If you are using a signal (pre_delete or post_delete), you might need to send it from the new function since you wouldn't want to call the real delete.

I've been doing object.deleted = 1 object.save() and not calling or overriding delete(). That way I still have the option to do the real delete in case I need it. You could probably make a real_delete() function to do that if needed though.

Read more comments by Greg Allard

]]>
Python Projects in Users’ Home Directories with wsgi http://gregallard.com/python-projects-in-users%e2%80%99-home-directories-with-wsgi-5/ Wed, 22 Jul 2009 19:48:51 +0000 I like the AddHandler approach more than what I was trying in this post. It is better since AddHandler will work in an .htaccess file. Which means this doesn't require a new public_python folder and doesn't require /p/ to be added to the url.

Before arriving at the solution in my post I tried using an .htaccess file and the directives I tried weren't supported in .htaccess. I didn't read the part about AddHandler so I missed that.

Something with either WSGIDaemonProcess or WSGIProcessGroup from the code in the blog post is making those applications work in daemon mode. It seems like any wsgi file that is touched will result in the code being reloaded for that project.

Read more comments by Greg Allard

]]>
A Django Model Manager for Soft Deleting Records and How to Customize the Django Admin http://gregallard.com/a-django-model-manager-for-soft-deleting-records-and-how-to-customize-the-django-admin-6/ Wed, 22 Jul 2009 19:38:01 +0000 I tested this out with a simple many to many example and I am not getting the soft deleted objects returned. With objects = SoftDeleteManager the many to many queries will be using get_query_set() which won't return the soft deleted records. I might need to see an example of how you are getting the deleted results to be able to figure out what is going on. I tried it with some_object.related_things.all() and the returned set won't have deleted related_things.

Read more comments by Greg Allard

]]>
Python Projects in Users’ Home Directories with wsgi http://gregallard.com/python-projects-in-users%e2%80%99-home-directories-with-wsgi-4/ Thu, 09 Jul 2009 15:06:18 +0000 I tried it without the LocationMatch directives and it works with just having AliasMatch in there for the static locations.

I didn't expect that WSGIDaemonProcess wouldn't expand the python_project_name. I was doing that so that each project would have a different process so touching one wsgi file wouldn't effect another project. It seemed like it was working like that.

If you can figure out a better way of doing this that would be awesome.

Read more comments by Greg Allard

]]>
Python Projects in Users’ Home Directories with wsgi http://gregallard.com/python-projects-in-users%e2%80%99-home-directories-with-wsgi-3/ Wed, 08 Jul 2009 22:27:03 +0000 Thanks for taking at look at this. I'll test it without SetHandler None when I get a chance. It is probably something I was keeping around from when I was using mod_python. I'm guessing I need to keep LocationMatch in there so that the request doesn't go to the wsgi file though, right?

Read more comments by Greg Allard

]]>
Python Projects in Users’ Home Directories with wsgi http://gregallard.com/python-projects-in-users%e2%80%99-home-directories-with-wsgi-2/ Wed, 08 Jul 2009 18:53:00 +0000 I tried doing it that way first, but the wsgi directives aren't allowed in an .htaccess file. It would have been much better to have a user place a few lines in their .htaccess file for python projects, but I didn't find a way of doing that.

Read more comments by Greg Allard

]]>
A Django Model Manager for Soft Deleting Records and How to Customize the Django Admin http://gregallard.com/a-django-model-manager-for-soft-deleting-records-and-how-to-customize-the-django-admin-4/ Thu, 02 Jul 2009 13:50:33 +0000 You can do this.
from somewhere import SoftDeleteManager

class NewManager(SoftDeleteManager):
'''new stuff'''

and in the model
objects = NewManager()

Read more comments by Greg Allard

]]>