示例#1
0
def build_page(url, deploy_dir):
    filename = os.path.join(deploy_dir, url)
    _ensure_dir(filename)
    html = simpress.web.create_app().test_client().get(
        url, follow_redirects=True).data.decode('utf-8')
    logger().info('build %s (%dbytes)' % (url, len(html)))
    with open(filename, 'w') as f:
        f.write(html)
示例#2
0
def build_page(url, deploy_dir):
    filename = os.path.join(deploy_dir, url)
    _ensure_dir(filename)
    html = simpress.web.create_app().test_client().get(
        url, follow_redirects=True).data.decode('utf-8')
    logger().info('build %s (%dbytes)' % (url, len(html)))
    with open(filename, 'w') as f:
        f.write(html)
示例#3
0
def copy_static_files(src, dst):
    logger().info('copy static files')
    shutil.copytree(
        src, dst,
        ignore=shutil.ignore_patterns('_*', '*.md', '*.py'))
示例#4
0
def truncate_deploy_dir(deploy_dir):
    if os.path.exists(deploy_dir):
        logger().info('truncate deploy dir "%s"' % deploy_dir)
        shutil.rmtree(deploy_dir)
示例#5
0
def copy_static_files(src, dst):
    logger().info('copy static files')
    shutil.copytree(src,
                    dst,
                    ignore=shutil.ignore_patterns('_*', '*.md', '*.py'))
示例#6
0
def truncate_deploy_dir(deploy_dir):
    if os.path.exists(deploy_dir):
        logger().info('truncate deploy dir "%s"' % deploy_dir)
        shutil.rmtree(deploy_dir)