On Aug 23, 9:17 pm, eXt <[EMAIL PROTECTED]> wrote: > Yes very familiar. I also experienced this kind of strange behaviour > from my app behind apache. Two things to do: > 1. restart apache after changes to your files (there is a directive to > autoreload described somewhere in the docs - useful for development)
The mod_python PythonAutoReload option and the Django means of auto reloading are both of no use when running Django under mod_python. The only way for changes to be picked up reliably is to restart Apache. The reason the OP sees the problem is that Apache is a multiprocess web server. Thus when he makes a change the old code may have already been loaded by some child processes, but other process which hadn't been used yet will pick up new code. Thus you see a mix of old and new code depending on which of the Apache child processes handld the request. > 2. if it doesn't help you then manually remove > your_problematic_module.pyc files That also will not help. If using Django under mod_python you should restart Apache when changing Python code files. Some may suggest that you set maximum number of requests per Apache child to 1. This however is a rather brute force approach and if doing that you may as well use CGI. Graham > Why it happends? I don't know. > > regards > Jakub Wiśniowski > > On 23 Sie, 12:01, "Timothy Kanters" <[EMAIL PROTECTED]> wrote: > > > Hey, > > > I've got django installed on a webserver with apache /mod_python/ > > mysql (on debian). I've got the latest svn version of django > > installed. > > I'm runinng through the tutorials but I'm getting some strange results. > > > Tutorial 1 went fine, so I've got the Poll / Choice models and I can > > work with their api through the python shell just fine. > > > In tutorial 2 however I've now got this: > > > """ > > class Poll(models.Model): > > question = models.CharField(max_length=200) > > pub_date = models.DateTimeField('date published') > > > class Admin: > > pass > > > def __unicode__(self): > > return self.question > > > def was_published_today(self): > > return self.pub_date.date() == datetime.date.today() > > """ > > > So as you see I've added the Admin class. This does make the poll show > > up in the admin interface but it seems very unreliable. When I refresh > > the index page sometimes 'poll' is there and other times it isn't. > > When it is there and I click on it, often it shows an error page: > > > """ > > AttributeError at /admin/polls/poll/add/ > > 'NoneType' object has no attribute 'get_field_sets' > > > Request Method: GET > > Request URL: http://__myurl__/admin/polls/poll/add/ > > Exception Type: AttributeError > > Exception Value: 'NoneType' object has no attribute 'get_field_sets' > > Exception Location: > > /usr/lib/python2.4/site-packages/django/contrib/admin/views/main.py > > in render_change_form, line 200 > > Python Executable: /usr/bin/python > > Python Version: 2.4.4 > > """ > > > However, sometimes when I click on it, it does just work and I can > > then add / edit poll objects. > > > I've also added an Admin class to the Choice object but it doesn't > > appear in the admin interface at all. And when I try to hack the url a > > bit by manually going to admin/choices/choice/ I get the error: "App > > u'choices', model u'choice', not found" > > > I get the same behaviour in both firefox and safari. Also the admin > > interface does seem to work well for the default apps users & groups. > > > Does this sound familiar to anyone? > > > Greets, > > Timothy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---