making botan-start runnable alone

This commit is contained in:
斟酌 鵬兄 2016-05-28 01:39:59 +08:00
parent 41f1ab4c90
commit 16377e0a95
4 changed files with 16 additions and 11 deletions

View File

@ -1,25 +1,25 @@
#!/usr/bin/env python3 #!env/bin/python
import os, pwd, grp import os, sys
from botanjs.config import Config as config, DEBUG from botanjs.config import Config as config, DEBUG
from subprocess import Popen
import shutil from botanjs.service.webapi import WebAPI
SiteRoot = os.path.abspath( "." ) SiteRoot = os.path.abspath( "." )
# Setting the SiteRoot for config
config["Paths"]["SiteRoot"] = SiteRoot; config["Paths"]["SiteRoot"] = SiteRoot;
# Create the lock folder for celery # Create the lock folder for celery
lockDir = SiteRoot + "env/var/run/celery" lockDir = os.path.join( SiteRoot, "env", "var", "run" "celery" )
os.makedirs( lockDir, exist_ok=True ) os.makedirs( lockDir, exist_ok=True )
import sys
from subprocess import Popen
sys.path.append( os.path.abspath( "." ) ) sys.path.append( os.path.abspath( "." ) )
from botanjs.service.webapi import WebAPI RUNTIME_ENV = os.path.abspath( os.path.join( "env", "bin" ) )
if RUNTIME_ENV not in os.environ[ "PATH" ]:
os.environ[ "PATH" ] = RUNTIME_ENV + os.pathsep + os.environ[ "PATH" ]
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -2,8 +2,9 @@
import os import os
from tempfile import NamedTemporaryFile from tempfile import NamedTemporaryFile
from botanjs.config import Config as config
COMPILER = "/opt/utils/closure.jar" COMPILER = config[ "BotanJS" ][ "ClosureCompiler" ]
if not os.path.isfile( COMPILER ): if not os.path.isfile( COMPILER ):
raise Exception( "Compiler not found" ) raise Exception( "Compiler not found" )

View File

@ -1,8 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os import os
from botanjs.config import Config as config
COMPILER = "/opt/utils/yuicompressor.jar" COMPILER = config[ "BotanJS" ][ "YuiCompressor" ]
if not os.path.isfile( COMPILER ): if not os.path.isfile( COMPILER ):
raise Exception( "Compiler not found" ) raise Exception( "Compiler not found" )

View File

@ -11,3 +11,6 @@ SrcDir = ${Paths:Runtime}/botanjs/src
CeleryBroker = redis://:${REDIS_PASS}@123.123.123.123:1234/9 CeleryBroker = redis://:${REDIS_PASS}@123.123.123.123:1234/9
REDIS_PASS = PASSWORD_FOR_REDIS_DB REDIS_PASS = PASSWORD_FOR_REDIS_DB
ClosureCompiler = /opt/utils/closure.jar
YuiCompressor = /opt/utils/yuicompressor.jar