Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross Origin requests to 127.0.0.1:8000 not allowed when running the example code #16

Closed
merc1er opened this issue Jun 21, 2021 · 2 comments

Comments

@merc1er
Copy link

merc1er commented Jun 21, 2021

  • django_private_chat2 version: 0.1.4
  • Django version: 3.2.3
  • Python version: 3.9.5
  • Operating System: macOS Big Sur

Description

Running the test app results in a cross origin error

What I Did

python manage.py migrate
python manage.py createsuperuser
python manage.py runserver

In the logs:

(0.001) SELECT "django_session"."session_key", "django_session"."session_data", "django_session"."expire_date" FROM "django_session" WHERE ("django_session"."expire_date" > '2021-06-21 11:44:57.252571' AND "django_session"."session_key" = 'XXX') LIMIT 21; args=('2021-06-21 11:44:57.252571', 'XXX')
(0.000) SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = 1 LIMIT 21; args=(1,)
WebSocket CONNECT /chat_ws [127.0.0.1:51810]
(0.001) SELECT "django_private_chat2_dialogsmodel"."user1_id", "django_private_chat2_dialogsmodel"."user2_id" FROM "django_private_chat2_dialogsmodel" WHERE ("django_private_chat2_dialogsmodel"."user1_id" = 1 OR "django_private_chat2_dialogsmodel"."user2_id" = 1); args=(1, 1)

In the frontend:
Screenshot 2021-06-21 at 18 39 37

@delneg
Copy link
Collaborator

delneg commented Jun 21, 2021

Hello,

That can happen if you use localhost:8000 instead of 127.0.0.1:8000
Please use 127.0.0.1:8000 for local testing (or change the url as described in #7 )

@merc1er
Copy link
Author

merc1er commented Jun 21, 2021

That worked! Thank you 🙏🏻

@merc1er merc1er closed this as completed Jun 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants