prevent loading un-necssary modules when using a handled, thanks Paolo

This commit is contained in:
mdipierro
2020-06-22 22:39:28 -07:00
parent cf76978a39
commit fc7c1bd2de
9 changed files with 43 additions and 27 deletions
+3
View File
@@ -62,6 +62,9 @@ if not os.path.isdir('applications'):
sys.path = [path] + [p for p in sys.path if not p == path]
from gluon.settings import global_settings
global_settings.web2py_runtime_handler = True
import gluon.main
wsgiref.handlers.CGIHandler().run(gluon.main.wsgibase)
+3 -1
View File
@@ -40,6 +40,9 @@ if not os.path.isdir('applications'):
sys.path = [path] + [p for p in sys.path if not p == path]
from gluon.settings import global_settings
global_settings.web2py_runtime_handler = True
import gluon.main
import gluon.contrib.gateways.fcgi as fcgi
@@ -51,7 +54,6 @@ else:
application = gluon.main.wsgibase
if SOFTCRON:
from gluon.settings import global_settings
global_settings.web2py_crontype = 'soft'
fcgi.WSGIServer(application, bindAddress='/tmp/fcgi.sock').run()
+5 -4
View File
@@ -49,14 +49,15 @@ from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
global_settings.web2py_runtime_handler = True
global_settings.web2py_runtime_gae = True
global_settings.db_sessions = True
if os.environ.get('SERVER_SOFTWARE', '').startswith('Devel'):
(global_settings.web2py_runtime, DEBUG) = \
('gae:development', True)
global_settings.web2py_runtime = 'gae:development'
DEBUG = True
else:
(global_settings.web2py_runtime, DEBUG) = \
('gae:production', False)
global_settings.web2py_runtime = 'gae:production'
DEBUG = False
import gluon.main
+2
View File
@@ -13,6 +13,8 @@ def __ExtensionFactory__():
if not os.path.isdir('applications'):
raise RuntimeError('Running from the wrong folder')
sys.path = [path] + [p for p in sys.path if not p == path]
from gluon.settings import global_settings
global_settings.web2py_runtime_handler = True
import gluon.main
import isapi_wsgi
application = gluon.main.wsgibase
+3
View File
@@ -40,6 +40,9 @@ if not os.path.isdir('applications'):
sys.path = [path] + [p for p in sys.path if not p == path]
from gluon.settings import global_settings
global_settings.web2py_runtime_handler = True
import gluon.main
+3 -1
View File
@@ -53,6 +53,9 @@ if not os.path.isdir('applications'):
sys.path = [path] + [p for p in sys.path if not p == path]
from gluon.settings import global_settings
global_settings.web2py_runtime_handler = True
import gluon.main
# uncomment one of the two imports below depending on the SCGIWSGI server installed
@@ -70,7 +73,6 @@ else:
application = wsgiapp
if SOFTCRON:
from gluon.settings import global_settings
global_settings.web2py_crontype = 'soft'
# uncomment one of the two rows below depending on the SCGIWSGI server installed
+2
View File
@@ -21,6 +21,8 @@ from gevent import monkey
monkey.patch_all()
def run(options):
from gluon.settings import global_settings
global_settings.web2py_runtime_handler = True
import gluon.main
if options.password != '<recycle>':
gluon.main.save_password(options.password, int(options.port))
+3 -1
View File
@@ -26,6 +26,9 @@ if not os.path.isdir('applications'):
sys.path = [path] + [p for p in sys.path if not p == path]
from gluon.settings import global_settings
global_settings.web2py_runtime_handler = True
import gluon.main
if LOGGING:
@@ -36,5 +39,4 @@ else:
application = gluon.main.wsgibase
if SOFTCRON:
from gluon.settings import global_settings
global_settings.web2py_crontype = 'soft'