Thank you very much - that all makes perfect sense. Margie
On Aug 6, 9:09 am, akaariai <akaar...@gmail.com> wrote: > On 6 elo, 18:36, Margie Roginski <margierogin...@yahoo.com> wrote: > > > Could anyone give me some pointers as to how you deal with taking your > > site down for maintenance? Is there some standard thing that people > > do to redirect all page requests to some sort of "Sorry, the site is > > down" page? Do you do this directly via apache or do you do it via > > django? > > Make a simple model for notifications and use that on your front page > to notify upcoming maintenance breaks. I also use this style to inform > updates done etc. The model could be something like this: > > class Notification(models.Model): > notification = models.TextField() > show_from = models.DateTimeField() > show_until = models.DateTimeField() > > def __unicode__(self): > return self.notification > > Put notifictions = > Notification.objects.filter(show_from__lte=datetime.now(), > show_until__gte=datetime.now()) into your template and show the > notification list there. Use apache to show the actual maintenance > break message when the site is down. > > > I additionally have a situation where when our mail server goes down, > > I would like to allow people to do GETS, but not POSTS. If you have > > any ideas on this I would be interested. > > One approach is to use middleware, and in the middleware check: > if request.method == 'POST' and email_is_down(): > return error page. > > You could also use a default context processor which puts > posts_allowed variable in the context and then in base.html have {% if > not posts_allowed %} Technical problems... saving not allowed {% endif > %}. You could also wrap your submit buttons in {% if posts_allowed %}. > Maybe disable also the edit links... > > - Anssi -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.