from flask import send_from_directory, send_file, redirect, jsonify, make_response
from webApp import webApp
from  config import config
import os

@webApp.route('/css/<path:path>')
def send_css(path):
    resp = make_response(send_from_directory(os.path.join(config['WEB_APP']['template_folder'], 'static/css'), path), 200)
    resp.headers['Cache-Control'] = 'public, max-age=31536000'
    return resp

@webApp.route('/js/<path:path>')
def send_js(path):
    resp = make_response(send_from_directory(os.path.join(config['WEB_APP']['template_folder'], 'static/js'), path), 200)
    resp.headers['Cache-Control'] = 'public, max-age=31536000'
    return resp


@webApp.route('/pic/<path:path>')
def send_pic(path):
    return send_from_directory(os.path.join(config['WEB_APP']['template_folder'], 'static/pics'), path), 200