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

uWSGI server not working like the docs #271

Open
jotauses opened this issue Jul 30, 2018 · 3 comments
Open

uWSGI server not working like the docs #271

jotauses opened this issue Jul 30, 2018 · 3 comments

Comments

@jotauses
Copy link

When I run the command in the docs:
uwsgi --virtualenv /path/to/virtualenv --http-socket /path/to/web.socket --gevent 1000 --http-websockets --workers=2 --master --module wsgi_websocket

I get the next error:

Traceback (most recent call last):
  File "/home/ubuntu/deploy/bbrainers/bbrainers/wsgi_websocket.py", line 13, in <module>
    from ws4redis.uwsgi_runserver import uWSGIWebsocketServer
  File "/home/ubuntu/deploy/bbrainers/venv/lib/python3.6/site-packages/ws4redis/uwsgi_runserver.py", line 5, in <module>
    from ws4redis.wsgi_server import WebsocketWSGIServer
  File "/home/ubuntu/deploy/bbrainers/venv/lib/python3.6/site-packages/ws4redis/wsgi_server.py", line 10, in <module>
    django.setup()
  File "/home/ubuntu/deploy/bbrainers/venv/lib/python3.6/site-packages/django/__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "/home/ubuntu/deploy/bbrainers/venv/lib/python3.6/site-packages/django/conf/__init__.py", line 56, in __getattr__
    self._setup(name)
  File "/home/ubuntu/deploy/bbrainers/venv/lib/python3.6/site-packages/django/conf/__init__.py", line 41, in _setup
    % (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
@jrief
Copy link
Owner

jrief commented Jul 30, 2018

there are so many different ways uWSGI is compiled. For instance the logger can be statically linked or is available as a 3rd party module. Presumably the latter is your problem.

@jotauses
Copy link
Author

jotauses commented Jul 30, 2018

I had to put os.environ.setdefault("DJANGO_SETTINGS_MODULE", "my_app.settings") before django_setup() in wsgi_server.py

Now the socket connects but I get this error and the message does not send:

`Traceback (most recent call last):
File "/home/ubuntu/deploy/bbrainers/venv/lib/python3.6/site-packages/django_websocket_redis-0.5.2-py3.6.egg/ws4redis/wsgi_server.py", line 131, in call
recvmsg = RedisMessage(websocket.receive())
File "/home/ubuntu/deploy/bbrainers/venv/lib/python3.6/site-packages/django_websocket_redis-0.5.2-py3.6.egg/ws4redis/uwsgi_runserver.py", line 31, in receive
raise WebSocketError(e)
ws4redis.exceptions.WebSocketError: unable to receive websocket message
[pid: 25855|app: 0|req: 2/4] 127.0.0.1 () {44 vars in 987 bytes} [Mon Jul 30 11:53:24 2018] GET /ws/notify?subscribe-broadcast/ => generated 38 bytes in 10736 msecs (HTTP/1.1 101) 4 headers in 184 bytes (3 switches on core 999)
WebSocketError: unable to receive websocket message
Traceback (most recent call last):
File "/home/ubuntu/deploy/bbrainers/venv/lib/python3.6/site-packages/django_websocket_redis-0.5.2-py3.6.egg/ws4redis/uwsgi_runserver.py", line 28, in receive
return uwsgi.websocket_recv_nb()
OSError: unable to receive websocket message

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/deploy/bbrainers/venv/lib/python3.6/site-packages/django_websocket_redis-0.5.2-py3.6.egg/ws4redis/wsgi_server.py", line 131, in call
recvmsg = RedisMessage(websocket.receive())
File "/home/ubuntu/deploy/bbrainers/venv/lib/python3.6/site-packages/django_websocket_redis-0.5.2-py3.6.egg/ws4redis/uwsgi_runserver.py", line 31, in receive
raise WebSocketError(e)
ws4redis.exceptions.WebSocketError: unable to receive websocket message
[pid: 25856|app: 0|req: 3/5] 127.0.0.1 () {44 vars in 987 bytes} [Mon Jul 30 11:53:35 2018] GET /ws/notify?subscribe-broadcast/ => generated 20 bytes in 3097 msecs (HTTP/1.1 101) 4 headers in 184 bytes (3 switches on core 998)`

@jee1mr
Copy link

jee1mr commented Dec 12, 2018

Any solution?

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