Beispiel #1
0
 def files(self):
     # The app
     app_html = template('app',app_meta=app_meta())
     #print app_html
     yield MyStringIO(app_html),'app','text/html'
     # All other static files
     for path,name in self.static_paths:
         fp = open(path,'r')
         dot_index = path.rfind('.')
         ext = path[dot_index:]
         content_type = FileGatherer.content_types.get(ext)
         if not content_type:
             content_type = 'binary/octet-stream'
         y = fp,name,content_type
         yield y
Beispiel #2
0
def stage():
    """Stage all the necessary static files!"""
    staged_dir = os.path.join(settings("DIRNAME"), "staged")
    staged_static_dir = os.path.join(staged_dir, "static")
    orig_static_dir = os.path.join(settings("DIRNAME"), "static")

    # Stage the app
    if not os.path.isdir(staged_dir):
        os.mkdir(staged_dir)
    app_html = template("app", app_meta=app_meta())
    open(os.path.join(staged_dir, "app"), "w").write(app_html)

    # Stage the static files!
    if not os.path.isdir(orig_static_dir):
        print "Couldn't find the static files dir"
        return
    if os.path.isdir(staged_static_dir):
        shutil.rmtree(staged_static_dir)
    shutil.copytree(orig_static_dir, staged_static_dir)