我在前端使用ReactJS,点击提交按钮后,它在开发环境中调用4个apis:
ReactDOM.render(
<ParameterForm url_schema="http://192.168.99.100/api/v1/var" url_uischema="http://192.168.99.100/api/v1/ui" url_data="http://192.168.99.100/api/v1/data" url_submit="http://192.168.99.100/api/v1/calculated" />,
document.getElementById('form')
);
我正在使用docker在本地运行应用程序,该应用程序的settings
文件夹包含base.py
,local.py
和production.py
。
对于Production-env,我希望api被称为这样的东西:
ReactDOM.render(
<ParameterForm url_schema="http://xyz:8000/api/v1/var" url_uischema="http://xyz:8000/api/v1/ui" url_data="http://xyz:8000/api/v1/data" url_submit="http://xyz:8000/api/v1/calculated" />,
document.getElementById('form')
);
我需要知道是否有一种方法可以在local.py
或production.py
中声明这些api,并且可以根据我运行应用程序的环境在我的DOM中动态调用。