简体   繁体   English

Api 适用于本地但不在生产中(Django Rest + Flutter)

[英]Api works on local but not in production (Django Rest + Flutter)

This is my first question in stackoverflow.这是我在stackoverflow中的第一个问题。 I have always found answers searching but this time...我一直在寻找答案,但这次......

I have 2 json generated by Django Rest Framework, both of them have just strings...我有 2 个 json 由 Django Rest 框架生成,它们都只有字符串...

The only thing i do is changing the local server urls for the production urls in my Flutter code.我唯一要做的就是在我的 Flutter 代码中更改生产 url 的本地服务器 url。

While using local urls, i can display the data from both of them correctly inside a Flutter App.在使用本地 url 时,我可以在 Flutter 应用程序中正确显示来自它们的数据。

While using production urls, only one is shown in the App and the other won't.使用生产网址时,应用程序中只显示一个,另一个不会。 Both jsons are rendered correctly in their production urls, i compared them with the local jsons urls and there is no difference at all.两个 json 都在其生产 url 中正确呈现,我将它们与本地 json url 进行了比较,根本没有区别。

Well, it is not really a question because i don't really know what to ask... just hoping some ideas... thanks.好吧,这不是一个真正的问题,因为我真的不知道该问什么......只是希望一些想法......谢谢。

make sure the AndroidManifest.xml includes the internet permission if not, add this between <Manifest> and <Application>确保 AndroidManifest.xml 包含互联网权限,如果没有,请在<Manifest><Application>之间添加

<uses-permission android:name="android.permission.INTERNET" /><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM