fix issue with sys.path. Now the path looks like 'root/gluon', 'root/site-packages', 'root' like in a normal web request
This commit is contained in:
+6
-7
@@ -73,13 +73,10 @@ import optparse
|
|||||||
import types
|
import types
|
||||||
import Queue
|
import Queue
|
||||||
|
|
||||||
if 'WEB2PY_PATH' in os.environ:
|
path = os.getcwd()
|
||||||
sys.path.append(os.environ['WEB2PY_PATH'])
|
|
||||||
else:
|
|
||||||
os.environ['WEB2PY_PATH'] = os.getcwd()
|
|
||||||
|
|
||||||
if not os.environ['WEB2PY_PATH'] in sys.path:
|
if 'WEB2PY_PATH' not in os.environ:
|
||||||
sys.path.append(os.environ['WEB2PY_PATH'])
|
os.environ['WEB2PY_PATH'] = path
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from gluon.contrib.simplejson import loads, dumps
|
from gluon.contrib.simplejson import loads, dumps
|
||||||
@@ -90,7 +87,8 @@ IDENTIFIER = "%s#%s" % (socket.gethostname(),os.getpid())
|
|||||||
|
|
||||||
logger = logging.getLogger('web2py.scheduler.%s' % IDENTIFIER)
|
logger = logging.getLogger('web2py.scheduler.%s' % IDENTIFIER)
|
||||||
|
|
||||||
from gluon import DAL, Field, IS_NOT_EMPTY, IS_IN_SET, IS_NOT_IN_DB, IS_INT_IN_RANGE, IS_DATETIME
|
from gluon import DAL, Field, IS_NOT_EMPTY, IS_IN_SET, IS_NOT_IN_DB
|
||||||
|
from gluon import IS_INT_IN_RANGE, IS_DATETIME
|
||||||
from gluon.utils import web2py_uuid
|
from gluon.utils import web2py_uuid
|
||||||
from gluon.storage import Storage
|
from gluon.storage import Storage
|
||||||
|
|
||||||
@@ -254,6 +252,7 @@ class MetaScheduler(threading.Thread):
|
|||||||
self.have_heartbeat = True # set to False to kill
|
self.have_heartbeat = True # set to False to kill
|
||||||
self.empty_runs = 0
|
self.empty_runs = 0
|
||||||
|
|
||||||
|
|
||||||
def async(self, task):
|
def async(self, task):
|
||||||
"""
|
"""
|
||||||
starts the background process and returns:
|
starts the background process and returns:
|
||||||
|
|||||||
Reference in New Issue
Block a user