Bearle / django-private-chat

(Deprecated - Please check out https://github.com/Bearle/django_private_chat2) Django one-to-one Websocket-based Asyncio-handled chat, developed by Bearle team
ISC License
424 stars 132 forks source link

Unable to run server #41

Closed saileshkush95 closed 4 years ago

saileshkush95 commented 5 years ago

Description

I'm trying to run server django-chat-server

What I Did

python manage.py run_chat_server

**Output**
(venv) sandeep@sandeep:~/Desktop/CustomAdminPanel$ python manage.py run_chat_server
Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/home/sandeep/Desktop/CustomAdminPanel/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/home/sandeep/Desktop/CustomAdminPanel/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/sandeep/Desktop/CustomAdminPanel/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 224, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/home/sandeep/Desktop/CustomAdminPanel/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 36, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/sandeep/Desktop/CustomAdminPanel/venv/lib/python3.7/site-packages/django_private_chat/management/commands/run_chat_server.py", line 3, in <module>
    import websockets
  File "/home/sandeep/Desktop/CustomAdminPanel/venv/lib/python3.7/site-packages/websockets/__init__.py", line 3, in <module>
    from .client import *
  File "/home/sandeep/Desktop/CustomAdminPanel/venv/lib/python3.7/site-packages/websockets/client.py", line 13, in <module>
    from .protocol import CONNECTING, OPEN, WebSocketCommonProtocol
  File "/home/sandeep/Desktop/CustomAdminPanel/venv/lib/python3.7/site-packages/websockets/protocol.py", line 17, in <module>
    from .compatibility import asyncio_ensure_future
  File "/home/sandeep/Desktop/CustomAdminPanel/venv/lib/python3.7/site-packages/websockets/compatibility.py", line 8
    asyncio_ensure_future = asyncio.async           # Python < 3.5
                                        ^
SyntaxError: invalid syntax
saemideluxe commented 5 years ago

In the requirements.txt it says websockets==3.2 which is outdated and this version has a problem with python 3.7 (because async is reserved keyword since python 3.7, therefore syntax error). Just run pip install --upgrade websockets in your (virtual) environment to get an updated package which fixes the issue.

saileshkush95 commented 5 years ago

Thanks I'll try...

morenoh149 commented 4 years ago

@saemideluxe when I changed the requirements.txt to websockets==8.1 the project still installs 3.2. Any idea why?

saemideluxe commented 4 years ago

@morenoh149 did you run pip install --upgrade -r requirements.txt? In case this would not work you could still try to uninstall the websockets package and reinstall it. If it still does not work you can either wait for the pull request #48 to be merged or post your pip commands and the output of the commands here. And maybe also your requirements.txt.

morenoh149 commented 4 years ago

yeah we found the package was declared twice, once in requirements.txt and again in setup.py. Fix is to upgrade both places and reinstall. Hopefully the PR gets merged.