Support for custom 503 responses
Added support for a custom 503 (temporary maintenance) page based upon the DISABLED file in an app folder
This commit is contained in:
1 parent
b84b47dad2
commit
24d1eea554
3 files changed
+7
-1
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
<html><body><h1>Temporarily down for maintenance</h1></body></html>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<html><body><h1>Temporarily down for maintenance</h1></body></html>
|
||||||
+5
-1
@@ -25,7 +25,7 @@ import socket
|
|||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
|
|
||||||
from gluon._compat import Cookie, urllib2
|
from pydal._compat import Cookie, urllib2
|
||||||
#from thread import allocate_lock
|
#from thread import allocate_lock
|
||||||
|
|
||||||
from gluon.fileutils import abspath, write_file
|
from gluon.fileutils import abspath, write_file
|
||||||
@@ -390,6 +390,10 @@ def wsgibase(environ, responder):
|
|||||||
% 'invalid request',
|
% 'invalid request',
|
||||||
web2py_error='invalid application')
|
web2py_error='invalid application')
|
||||||
elif not request.is_local and exists(disabled):
|
elif not request.is_local and exists(disabled):
|
||||||
|
if os.path.exists(os.path.join(request.folder,'static','503.html')):
|
||||||
|
import urllib
|
||||||
|
raise HTTP(503, urllib.urlopen(os.path.join(request.folder,'static','503.html')).read())
|
||||||
|
else:
|
||||||
raise HTTP(503, "<html><body><h1>Temporarily down for maintenance</h1></body></html>")
|
raise HTTP(503, "<html><body><h1>Temporarily down for maintenance</h1></body></html>")
|
||||||
|
|
||||||
# ##################################################
|
# ##################################################
|
||||||
|
|||||||
Reference in new issue
Block a user