Example #1
0
 def handle (self, *args, **options):
   slug = options['conf_slug']
   
   os.chdir(settings.BASE_DIR)
   subprocess.call('echo "RELEASE = \'"`git rev-parse --short HEAD`"\'" > release_hash.py', shell=True)
   
   from release import release
   rel = release()
   
   os.chdir(settings.FRONT_ROOT)
   
   dirs = []
   files = []
   for item in os.listdir():
     if os.path.isdir(item):
       rp = os.path.join(item, 'release.txt')
       if item != 'static' and not os.path.exists(rp):
         dirs.append(item)
         
     else:
       files.append(item)
       
   deploy_dir = os.path.join(settings.FRONT_ROOT, slug, 'app-{}'.format(rel))
   if not os.path.exists(deploy_dir):
     os.makedirs(deploy_dir)
     
   for file in files:
     subprocess.call("cp -v {} {}".format(file, deploy_dir), shell=True)
     
   for d in dirs:
     subprocess.call("cp -rv {} {}".format(d, deploy_dir), shell=True)
     
   less = os.path.join(deploy_dir, 'css', 'pytx')
   subprocess.call("lessc {}.less {}.css".format(less, less), shell=True)
   
   html = index_generator(slug, dev=False)
   indexes = (
     os.path.join(deploy_dir, 'index.html'),
     os.path.join(settings.FRONT_ROOT, slug, 'index.html'),
   )
   
   for index in indexes:
     fh = open(index, 'w')
     fh.write(html)
     fh.close()
     
   for file in ('logo144.png', 'offline.html', 'manifest.json'):
     cp = os.path.join(settings.FRONT_ROOT, slug, file)
     subprocess.call("cp -v {} {}".format(file, cp), shell=True)
     
   gen_path = os.path.join(deploy_dir, 'generated')
   subprocess.call("date > {}".format(gen_path), shell=True)
   
   release_path = os.path.join(settings.FRONT_ROOT, slug, 'release.txt')
   subprocess.call("echo '{}' > {}".format(rel, release_path), shell=True)
   
Example #2
0
def index (request, conf_slug):
  conf_slug = conf_slug.split('/')[0]
  
  html = index_generator(conf_slug, dev=True)
  return http.HttpResponse(html)
Example #3
0
def index(request, conf_slug):
    conf_slug = conf_slug.split('/')[0]

    html = index_generator(conf_slug, dev=True)
    return http.HttpResponse(html)