vitorfs / bootcamp

An enterprise social network
trybootcamp.vitorfs.com
MIT License
2.28k stars 997 forks source link

Error while posting news #225

Closed verkko closed 4 years ago

verkko commented 4 years ago

I have installed on windows 10 locally. am getting an error while submitting my 1st news, Please find the image below 1

sebastian-code commented 4 years ago

Hi @verkko can you share the whole stack trace of the error? The screenshot you are sharing takes away all the relevant data. It would be very helpful to have so I can understand what is happening. Also, can you share with me the URL you were trying to call?

verkko commented 4 years ago

Environment:

Request Method: POST Request URL: http://127.0.0.1:8000/comments/post/

Django Version: 3.0.5 Python Version: 3.7.6 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'django.contrib.admin', 'django.forms', 'crispy_forms', 'sorl.thumbnail', 'allauth', 'allauth.account', 'allauth.socialaccount', 'channels', 'django_comments', 'graphene_django', 'markdownx', 'taggit', 'bootcamp.users.apps.UsersConfig', 'bootcamp.articles.apps.ArticlesConfig', 'bootcamp.messager.apps.MessagerConfig', 'bootcamp.news.apps.NewsConfig', 'bootcamp.notifications.apps.NotificationsConfig', 'bootcamp.qa.apps.QaConfig', 'bootcamp.search.apps.SearchConfig', 'debug_toolbar', 'django_extensions'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'debug_toolbar.middleware.DebugToolbarMiddleware']

Traceback (most recent call last): File "C:\Users\ameen\PycharmProjects\bk6\newbk\lib\site-packages\django\core\handlers\exception.py", line 34, in inner response = get_response(request) File "C:\Users\ameen\PycharmProjects\bk6\newbk\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "C:\Users\ameen\PycharmProjects\bk6\newbk\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, callback_kwargs) File "C:\Users\ameen\AppData\Local\Programs\Python\Python37\lib\contextlib.py", line 74, in inner return func(*args, *kwds) File "C:\Users\ameen\PycharmProjects\bk6\newbk\lib\site-packages\django\utils\decorators.py", line 130, in _wrapped_view response = view_func(request, args, kwargs) File "C:\Users\ameen\PycharmProjects\bk6\newbk\lib\site-packages\django\views\decorators\http.py", line 40, in inner return func(request, *args, *kwargs) File "C:\Users\ameen\PycharmProjects\bk6\newbk\lib\site-packages\django_comments\views\comments.py", line 126, in post_comment request=request File "C:\Users\ameen\PycharmProjects\bk6\newbk\lib\site-packages\django\dispatch\dispatcher.py", line 175, in send for receiver in self._live_receivers(sender) File "C:\Users\ameen\PycharmProjects\bk6\newbk\lib\site-packages\django\dispatch\dispatcher.py", line 175, in for receiver in self._live_receivers(sender) File "C:\Users\ameen\PycharmProjects\bk6\bootcamp\bootcamp\articles\models.py", line 93, in notify_comment notification_handler(actor, receiver, Notification.COMMENTED, action_object=obj) File "C:\Users\ameen\PycharmProjects\bk6\bootcamp\bootcamp\notifications\models.py", line 243, in notification_handler actor, key, id_value=id_value, recipient=recipient.username File "C:\Users\ameen\PycharmProjects\bk6\bootcamp\bootcamp\notifications\models.py", line 273, in notification_broadcast async_to_sync(channel_layer.group_send)("notifications", payload) File "C:\Users\ameen\PycharmProjects\bk6\newbk\lib\site-packages\asgiref\sync.py", line 120, in call return call_result.result() File "C:\Users\ameen\AppData\Local\Programs\Python\Python37\lib\concurrent\futures_base.py", line 428, in result return self.get_result() File "C:\Users\ameen\AppData\Local\Programs\Python\Python37\lib\concurrent\futures_base.py", line 384, in get_result raise self._exception File "C:\Users\ameen\PycharmProjects\bk6\newbk\lib\site-packages\asgiref\sync.py", line 180, in main_wrap result = await self.awaitable(args, kwargs) File "C:\Users\ameen\PycharmProjects\bk6\newbk\lib\site-packages\channels_redis\core.py", line 614, in group_send async with self.connection(self.consistent_hash(group)) as connection: File "C:\Users\ameen\PycharmProjects\bk6\newbk\lib\site-packages\channels_redis\core.py", line 835, in aenter self.conn = await self.pool.pop() File "C:\Users\ameen\PycharmProjects\bk6\newbk\lib\site-packages\channels_redis\core.py", line 73, in pop conns.append(await aioredis.create_redis(self.host, loop=loop)) File "C:\Users\ameen\PycharmProjects\bk6\newbk\lib\site-packages\aioredis\commands__init__.py", line 175, in create_redis loop=loop) File "C:\Users\ameen\PycharmProjects\bk6\newbk\lib\site-packages\aioredis\connection.py", line 113, in create_connection timeout) File "C:\Users\ameen\AppData\Local\Programs\Python\Python37\lib\asyncio\tasks.py", line 414, in wait_for return await fut File "C:\Users\ameen\PycharmProjects\bk6\newbk\lib\site-packages\aioredis\stream.py", line 24, in open_connection lambda: protocol, host, port, **kwds) File "C:\Users\ameen\AppData\Local\Programs\Python\Python37\lib\asyncio\base_events.py", line 958, in create_connection raise exceptions[0] File "C:\Users\ameen\AppData\Local\Programs\Python\Python37\lib\asyncio\base_events.py", line 945, in create_connection await self.sock_connect(sock, address) File "C:\Users\ameen\AppData\Local\Programs\Python\Python37\lib\asyncio\selector_events.py", line 473, in sock_connect return await fut File "C:\Users\ameen\AppData\Local\Programs\Python\Python37\lib\asyncio\selector_events.py", line 503, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}')

Exception Type: ConnectionRefusedError at /comments/post/ Exception Value: [Errno 10061] Connect call failed ('127.0.0.1', 6379)

sebastian-code commented 4 years ago

Ahh, I see, the issue you're experiencing is related to your Redis setup. Check your local redis configuration, and validate than the ASGI server is running properly.

verkko commented 4 years ago

Yeah, That got sloved. Can you please check this once.

Screenshot (7)

Vamoss commented 4 years ago

This should solve, there is already a pull-request: https://github.com/Vamoss/bootcamp/commit/6d991dd400de1b1ce18261df3757a5dacf9a6762

It happens when a news doesn't have a URL in the text.

sebastian-code commented 4 years ago

Fixed in the last version @verkko