I build a simple REST api with Eve and Python.
from flask import redirect, send_from_directory, render_template
from eve import Eve
import os
PWD = os.environ.get('PWD')
public = os.path.join(PWD, 'public')
app = Eve(static_folder=public)
# serve index.html
@app.route('/')
def index():
return send_from_directory(public, 'index.html')
# start the app
if __name__ == '__main__':
app.run()
Where I just serve a static HTML files from /public
folder when /
is requested.
I'm using bower to install bootstrap:
<link rel="stylesheet" type="text/css" href="bower_components/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="bower_components/bootstrap/dist/css/bootstrap-theme.css">
But the problem is that the files are not being found although the path is correct.
Can someone explain me why is this happening?
Apparently the path for my bower_components should be /public/bower_components/../../