In react, I created a folder ./public/assets
, and put an image in the ./public/assets
. Everything works well when I run npm start
.
After running npm run build
in react, I get a ./build
folder. I copied files and folders inside the ./build
folder to a flask folder. Since the index.html
should be put in ./templates
in flask, the browser can't get the image in flask ./assets
.
The files in flask:
.
├── app.py
├── asset-manifest.json
├── assets
│ └── Montage_of_Toronto_7.jpg
├── favicon.ico
├── manifest.json
├── precache-manifest.28e9dd49c9646209098c5bb088bdb16f.js
├── service-worker.js
├── static
│ ├── css
│ │ ├── main.2cce8147.chunk.css
│ │ └── main.2cce8147.chunk.css.map
│ ├── js
│ │ ├── 2.38e0f74c.chunk.js
│ │ ├── 2.38e0f74c.chunk.js.map
│ │ ├── main.1c5ab122.chunk.js
│ │ ├── main.1c5ab122.chunk.js.map
│ │ ├── runtime~main.a8a9905a.js
│ │ └── runtime~main.a8a9905a.js.map
│ └── media
│ └── logo.5d5d9eef.svg
└── templates
└── index.html
the folders in react/public:
.
├── assets
│ └── Montage_of_Toronto_7.jpg
├── favicon.ico
├── index.html
└── manifest.json
the files in react/build
.
├── asset-manifest.json
├── assets
│ └── Montage_of_Toronto_7.jpg
├── favicon.ico
├── index.html
├── manifest.json
├── precache-manifest.28e9dd49c9646209098c5bb088bdb16f.js
├── service-worker.js
└── static
├── css
│ ├── main.2cce8147.chunk.css
│ └── main.2cce8147.chunk.css.map
├── js
│ ├── 2.38e0f74c.chunk.js
│ ├── 2.38e0f74c.chunk.js.map
│ ├── main.1c5ab122.chunk.js
│ ├── main.1c5ab122.chunk.js.map
│ ├── runtime~main.a8a9905a.js
│ └── runtime~main.a8a9905a.js.map
└── media
└── logo.5d5d9eef.svg
Is there any solution that can configure the public path so that the ./public
folder will be put into ./build/static
?
I use send_from_directory
in flask backend to serve the files in ./assets
. But I would like to put files to ./build/static
folder when I run npm run build
, including the files favicon.ico
, manifest.json
and so on.