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

to setup the example on 0.0.0.0 #7

Open
Nehereus opened this issue May 1, 2021 · 2 comments
Open

to setup the example on 0.0.0.0 #7

Nehereus opened this issue May 1, 2021 · 2 comments

Comments

@Nehereus
Copy link

Nehereus commented May 1, 2021

  • 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!

@delneg
Copy link
Collaborator

delneg commented May 6, 2021

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)

@VSofficial
Copy link

VSofficial commented Sep 2, 2021

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

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

3 participants