Re: [pylons-discuss] Re: Pyramid maintenance mode

2021-01-07 Thread Mike Orr
I forgot the last line. The end of 'my_tween_factory' needs to 'return my_tween'. On Thu, Jan 7, 2021 at 7:05 PM Mike Orr wrote: > I have a request-logging tween in only a page of code. It's > straightforward to write from the documentation. > >

Re: [pylons-discuss] Re: Pyramid maintenance mode

2021-01-07 Thread Mike Orr
I have a request-logging tween in only a page of code. It's straightforward to write from the documentation. https://pyramid.readthedocs.io/en/latest/narr/hooks.html#registering-tweens I adapted the code for your use case (untested). Your module would have something like this: # Module

Re: [pylons-discuss] Re: Pyramid maintenance mode

2021-01-07 Thread C J
That's really interesting Thierry. Can you please show me how to do? I have tried to use tweens. I tried many things starting with *pyramid.tweens = pyramid_maintenance.tween_maintenance *and modifying the *__init__.py* file, however, I do not understand what they are and how to use them despite

[pylons-discuss] Re: Pyramid maintenance mode

2021-01-07 Thread 'Jonathan Vanasco' via pylons-discuss
i should add, the pattern for doing this in nginx is often called a flag or semaphore i found this article that goes through a how-to https://blog.devcloud.hosting/configuring-nginx-for-quickly-switching-to-maintenance-mode-e4136cf497f3 basically, you just touch/remove a specific file to

Re: [pylons-discuss] Re: Pyramid maintenance mode

2021-01-07 Thread Thierry Florac
I've built a custom Pyramid tween to handle this and redirect requests while application is up! It can handle redirects (based on regular expressions) before or after the request is handled by Pyramid application, to be able to set the site in "maintenance mode", or to handle custom redirects in

[pylons-discuss] Re: Pyramid maintenance mode

2021-01-07 Thread 'Jonathan Vanasco' via pylons-discuss
I typically handle this on nginx which sites in front of Pyramid. if you wanted to do everything in python, you could probably use WSGI middleware to route to a separate maintenance application or html file. On Thursday, January 7, 2021 at 10:09:34 AM UTC-5 C J wrote: > Hi everybody, > > I am

[pylons-discuss] Pyramid maintenance mode

2021-01-07 Thread C J
Hi everybody, I am looking for an easy way to temporarily redirect all the users of my pyramid website to a maintenance vue without having to comment/delete, etc my routes. I would like to make it easy to re-activate the others routes when the maintenance is done. I found this :