How can I serve the deliverables of create-react-app via Flask?
After npm run build, this is roughly my folder tree:
src/
├── service/
│ └── app.py
└── content/
├── static
│ ├── css
│ │ └── many css files...
│ ├── js
│ │ └── many js files...
│ └── media
│ └── some images...
├── index.html
├── service-worker.js
└── manifest.json
That's the server's code:
app = Flask(__name__, template_folder='../content', static_folder='../content')
@app.route('/')
def home():
return flask.render_template('index.html')
@app.route('/static/<path:path>')
def static_files(path):
return flask.send_from_directory('../content/static', path)
if __name__ == '__main__':
app.run(debug=True)
The main html, index.html is served successfully. So are all the files under content/static/.
The files under content/ however (except index.html), are not delivered at all (error 404, not found).
build/directory but this doesn't appear in the directory listing?