@app.template_global()
def static_url(filename):
    static_url = app.config.get('STATIC_URL')
if static_url:
    return urljoin(static_url, filename)
return url_for('static', filename=filename)
Serve static files from a CDN rather than Flask in production