Ask coding questions

← Back to all posts
django_backend
kotrotkot (0)

How to use my django project on Repl.it as a server? I tried to do it directly, but it does not work.

My Flutter frontend on FlutLab does not see my Django backend on Repl.it. 0

I am trying (unsuccessfully) to get data from my django backend, developed on repl.it, to my flutter frontend, developed on FlutLab. On Flutter side, I get data successfully from, for example, https://jsonplaceholder.typicode.com/users. On Django side, I render my data normally and get data by Postman, also without problem.

But if my frontend send get() request directly to backend, I see just my circular indicator.

My URL on Flutter/Dio looks like Response response = await Dio().get("https://djangobackend.myaccountname.repl.co/");

My ALLOWED_HOSTS on Django looks like

ALLOWED_HOSTS = ['djangobackend.myaccountname.repl.co', '0.0.0.0:3000', 'localhost', '127.0.0.1']
Actually I have no idea which host/port I need to use in this case, so, I just added all I could think of.

Is it possible to get data from my backend to frontend in this case and how to do it if yes?

I also can provide more details if necessary.

All ideas are highly appreciated!

Comments
hotnewtop
ch1ck3n (1553)

in mysite/urls put

from django.contrib import admin
from django.urls import include, path

urlpatterns = [
    path("admin/", admin.site.urls, name="admin"),
    path("", include("backend.urls"))
]
kotrotkot (0)

@ch1ck3n Yes I did it. The same result: no communication between frontend and backend. Anyway, thank you for reaction. If you have more ideas, I am happy to try)