django_private_chat2 icon indicating copy to clipboard operation
django_private_chat2 copied to clipboard

to setup the example on 0.0.0.0

Open Nehereus opened this issue 4 years ago • 2 comments

  • django_private_chat2 version: latest
  • Django version: 3.2
  • Python version: 3.8.5
  • Operating System: debian 10 unstable

Description

I am striving to make the example work on the interface 0.0.0.0 so that I can deploy the instance on the server and access it through the internet. I can access the website but I failed at getting the error " Failed to fetch" and show no users nor messages.

What I Did

change the host in backendUrl from 127.0.0.1 to 0.0.0.0:8000 and the corresponding main.js as well. I am very new to Django and these frontend frameworks. If the question is too dumb, please forgive me. Thank you very much!

Nehereus avatar May 01 '21 08:05 Nehereus

Hello, please ensure that the firewall is not blocking incoming requests on port 8000. Also, it would be a good idea to setup some simple django project for production. https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Deployment https://docs.djangoproject.com/en/3.2/howto/deployment/ https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-20-04 https://www.youtube.com/watch?v=Sa_kQheCnds https://www.youtube.com/watch?v=_MbZSSXdM8s Debian 10: https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-debian-10

here are some guides to help you out.

Edit: Please note that backend url is also hardcoded in the example app. You might need to change the url in the frontend app and re-compile it here: https://github.com/Bearle/django_private_chat2/blob/master/example/frontend/fs-src/App.fs#L227 (or just replace 'http://127.0.0.1:8000' in static/js/main.js file)

delneg avatar May 06 '21 18:05 delneg

In my case it worked on live server with [server ip address]:8000, 0.0.0.0 will not work, instead write IP address of server provided with, it will workout. Also the PORT should be constant, which in case of Heroku is not $PORT is allotted dynamically so use another server for deployment

VSofficial avatar Sep 02 '21 17:09 VSofficial