django-private-chat
django-private-chat copied to clipboard
Can you please help me on how to run it on heroku?
Want to run it on heroku or any other server with the main django application. Please help me on this.
+1
You can look here. https://simpleisbetterthancomplex.com/tutorial/2016/08/09/how-to-deploy-django-applications-on-heroku.html
Thank you for reply! My question (and probably the original question as well) is however, how is it possible to run the chat app on Heroku inside my main Django app.
Should I add another dyno specific for the chat app?
Or how can I ran the command python manage.py run_chat_server
while deploying on Heroku?
Thank you very much in advance
You want to test the application on heroku? After final migration the application will automatically be deployed on heroku.
So please correct me if I'm wrong: you are saying that the chat should work on Heroku without any further configurations?
My main app including chat are deployed on Heroku, all migrations are run, but the chat doesn't work for some reasons. The messages are not getting sent, whereas locally it works fine.
You'll need to add configurations required for chat app. For simplicity you can try python anywhere. It allows you to upload your own virtualenv and run app.
I have a similar problem. Everything works on the local server, but no messages are sent to Heroku.
I run heroku run bash
and python manage.py run_chat_server
Server starts without errors.
My settings.py
CHAT_WS_SERVER_HOST = '0.0.0.0' CHAT_WS_SERVER_PORT = 5002 CHAT_WS_SERVER_PROTOCOL = 'wss' DATETIME_FORMAT = "d N в H:i"
I am using https protocol. In the browser console WebSocket connection to 'wss://0.0.0.0:5002/dfs5k7c05k20w236xxhvelsrfm2adpgo/devkd' failed: Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR
I want to host the application on heroku, Everything works as expected on local server, but while deploying on heroku chat server is not working. I am getting the error : OSError: [Errno 99] error while attempting to bind on address ('XX.XX.XXX.XX', XXXX): cannot assign requested address. Procfile contents are: web: gunicorn chatApp.wsgi --log-file - worker: python manage.py run_chat_server I m running run_chat_server command on seperate worker dyno In settings.py chat server settings are: CHAT_WS_SERVER_HOST = 'myappname.herokuapp.com' CHAT_WS_SERVER_PORT = os.environ['PORT'] CHAT_WS_SERVER_PROTOCOL = 'ws' Can anyone help me to resolve the error?
I'm experiencing the same issue as @bilalzahoor. Has anyone been able to resolve this?
I was able to get an application with django-private-chat running on Heroku. The key was to run the chat service as a separate Heroku web app. I deployed two versions of the application to separate Heroku apps, only changing the Procfile.
Here are what each Procfile looks like
#Chat Service Procfile
web: python manage.py run_chat_server
#Django Application Procfile
web: gunicore <app_name>.wsgi
The settings I used were:
#settings.py
CHAT_WS_SERVER_HOST = '0.0.0.0'
CHAT_WS_SERVER_PROTOCOL = 'wss'
CHAT_WS_SERVER_PORT = int(os.environ.get('PORT', 5002))
In addition, I modified the var base_ws_server_path = ‘wss://<chat-service-app-name>.herokuapp.com/'
in templates>django_private_chat>dialogs.html.
Let me know if you have any questions.
[email protected]:3354 WebSocket connection to 'wss://0.0.0.0:5002/dq4rjlg08bvt1adsdb8gwuk0ct05mmgn/[email protected]' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
CHAT_WS_SERVER_HOST = '0.0.0.0' CHAT_WS_SERVER_PORT = 5002 CHAT_WS_SERVER_PROTOCOL = 'wss' SESSION_COOKIE_AGE = 12096000
in production server :/ i have my ip but doesn't work my demon is this
[Unit]
Description=El Trabajo Deseado Chat
After=network.target
[Service] EnvironmentFile=/home/ubuntu/etd/eltrabajodeseado/variables.env
User=ubuntu
Group=www-data
WorkingDirectory=/home/ubuntu/etd/eltrabajodeseado
ExecStart=/home/ubuntu/etd-env/bin/python /home/ubuntu/etd/eltrabajodeseado/manage.py run_chat_server
[Install]
WantedBy=multi-user.target
somebody can help me please
@MattBrown88 I created two versions of the same Django app and pushed on heroku but it is still showing me application error. I added the Procfile and updated settings.py in both versions.
Hey - I can try to help but you’ll have to send me the error message. To get this, look in the Heroku log files.
I need more information :)
On Wed, Apr 28, 2021 at 1:53 PM Atiya Rabbi @.***> wrote:
@MattBrown88 https://github.com/MattBrown88 I created two versions of the same Django app and pushed on heroku but it is still showing me application error. I added the Procfile and updated settings.py in both versions.
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/Bearle/django-private-chat/issues/40#issuecomment-828699067, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEXMPLPJGAFTCLLPQWRHO3TTLBKQ7ANCNFSM4HJSSEZA .
-- Matt Brown Freelance Software Developer www.MatthewLBrown.com https://MatthewLBrown.com, LinkedIn https://www.linkedin.com/in/matthew-brown-44b91017/
Please check out https://github.com/Bearle/django_private_chat2 It's using Django Channels and thus must be much simpler to run on heroku (no separate ws server)
@MattBrown88 This is what I did
- created another folder of the same Django app in my local system.
- updated the Procfile
- updated settings.py of both apps as mentioned above
- also updated allowed hosts in settings.py as ALLOWED_HOSTS = ['abc.herokuapp.com', 'chat-server.herokuapp.com'] Heroku log files of both apps are showing No module named 'django_private_chat'
@delneg Is django-private-chat2 similar in application as django-private-chat?
That means that you haven’t successfully installed django-private-chat on Heroku
On Wed, Apr 28, 2021 at 6:04 PM Atiya Rabbi @.***> wrote:
@delneg https://github.com/delneg Is django-private-chat2 similar in application as django-private-chat?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Bearle/django-private-chat/issues/40#issuecomment-828835932, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEXMPLLPZOQ647JZ2TGQACDTLCH7JANCNFSM4HJSSEZA .
-- Matt Brown Freelance Software Developer www.MatthewLBrown.com https://MatthewLBrown.com, LinkedIn https://www.linkedin.com/in/matthew-brown-44b91017/
Okay @MattBrown88 , so I added django-private-chat==0.3.0 in requirements.txt now the app is running on Heroku but in the console of my browser it tells me that the WebSocket connection is failed: WebSocket connection to 'wss://0.0.0.0:43049/paymkzknirnqt5cwoo2cvzgn8hadtyox/username_abc' failed:
It means that WebSocket is in a closed state. I even tried to restart the heroku server, still, I am unable to establish a connection to send and receive messages.
Will you please help me out here?