Web redirection

161 views
Skip to first unread message

Raymond Nsubuga

unread,
Jan 23, 2024, 3:34:59 PM1/23/24
to django...@googlegroups.com
Am working on a django react project but everytime i run my django server at port 8000, it instead redirects to port 3000 belonging to react automatically, what is the issue that can be causing this ?. And how am i able to solve it ?

Obodoma Uzondu Vincent

unread,
Jan 23, 2024, 6:58:52 PM1/23/24
to django...@googlegroups.com
Are you using cors?

On Tue, Jan 23, 2024 at 4:34 PM Raymond Nsubuga <raymond...@gmail.com> wrote:
Am working on a django react project but everytime i run my django server at port 8000, it instead redirects to port 3000 belonging to react automatically, what is the issue that can be causing this ?. And how am i able to solve it ?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJpDcBTvmMd94%2BBnr3aN3c7VGv3m80opQDm7kiA83YxkZpEkHA%40mail.gmail.com.

Light Ofor

unread,
Jan 23, 2024, 8:43:40 PM1/23/24
to django...@googlegroups.com
You know that Django is for the backend right, so what I do I have two terminals open, one for Django and one for react, if I want my Django page I simply copy the URL from the terminal and paste on my web browser and I get my Django page.

Muhammad Juwaini Abdul Rahman

unread,
Jan 24, 2024, 1:35:52 AM1/24/24
to django...@googlegroups.com
Can you show the screenshot of your terminal?

On Tue, 23 Jan 2024 at 23:34, Raymond Nsubuga <raymond...@gmail.com> wrote:
Am working on a django react project but everytime i run my django server at port 8000, it instead redirects to port 3000 belonging to react automatically, what is the issue that can be causing this ?. And how am i able to solve it ?

--

Akorede Habeebullah

unread,
Jan 24, 2024, 6:26:33 AM1/24/24
to django...@googlegroups.com
Close both terminals, then restart the Django server first before starting React. 

Ryan Nowakowski

unread,
Jan 25, 2024, 8:00:28 PM1/25/24
to django...@googlegroups.com
Open the developer tools in your browser. Is your request to Django coming back with a 30x response? Sometimes the browser will cache a permanent redirect. You might also try clearing your cache.

Light Ofor

unread,
Jan 26, 2024, 10:50:53 AM1/26/24
to django...@googlegroups.com
On Wed, Jan 24, 2024, 2:35 AM Muhammad Juwaini Abdul Rahman <juw...@gmail.com> wrote:
IMG_20240126_114140_927.jpg

Obam Olohu

unread,
Jan 26, 2024, 11:34:39 AM1/26/24
to django...@googlegroups.com
if you want to set your port back top 8000: Check React's Proxy Configuration:  pip install django-cors-headers
# settings.py

INSTALLED_APPS = [
    # ...
    'corsheaders',
    # ...
]

MIDDLEWARE = [
    # ...
    'corsheaders.middleware.CorsMiddleware',
    # ...
]

On Tue, Jan 23, 2024 at 4:34 PM Raymond Nsubuga <raymond...@gmail.com> wrote:
Am working on a django react project but everytime i run my django server at port 8000, it instead redirects to port 3000 belonging to react automatically, what is the issue that can be causing this ?. And how am i able to solve it ?

--
Reply all
Reply to author
Forward
0 new messages