Re: need to support anonymous users with a simple one time disclaimer agreement

2019-08-04 Thread Ken Whitesell
Gregory, Not only is it not practical in Django, it's not a realistic solution using any framework. There is no "machine ID" that is exposed to a web site, and originating IP addresses completely fails for all people accessing your site from behind a NAT box or other similar functional

Re: How to use permissions on a CreateView class?

2019-05-29 Thread Ken Whitesell
Fellipe, In addition to the permissions_required variable, I believe you also need to include the PermissionsRequired mixin in your class definition: https://docs.djangoproject.com/en/2.2/topics/auth/default/#the-permissionrequiredmixin-mixin Ken On Tuesday, May 28, 2019 at 5:54:39 PM UTC-4,

Re: how handle high incoming data and sending throttled data to web sockets in django-channels

2019-01-15 Thread Ken Whitesell
We deal with a similar rate of data acquisition, and have taken a different approach. (We get, on average, about 10,000,000 UDP messages / day) We have a very small UDP listener (about 50 lines of Python 3 code), and _all_ it does is receive the message and dump it into a Celery queue. We then

Re: Nullable vs empty strings

2018-05-03 Thread Ken Whitesell
Nick, A null string (string with length 0) is _not_ the same as a null field (no string). The two are distinct, and (can) serve two very different functions. Take a look at this for some more detailed information:

Re: Multiple websocket connection vs single websocket connection when using django channels

2018-04-06 Thread Ken Whitesell
Hi Robin, I can't speak to any generalized situations, or what might be considered "best practices" or most optimal. What I can say is that we have gone with the single websocket connection for each client - whether it's a real person at a browser or an application. All our communications

Re: How to run an external command that must run with the server

2018-04-03 Thread Ken Whitesell
es sense. So leave the source as a management command (as it is > now), and just run python manage.py source through supervisor? > > > On Sunday, 1 April 2018 13:16:38 UTC+1, Ken Whitesell wrote: > > > > We set up all our Django-related processes as a gr

Re: How to run an external command that must run with the server

2018-04-01 Thread Ken Whitesell
We set up all our Django-related processes as a group under supervisor. This includes our celery-based processes. (We have some long-running tasks that are kicked off by the web site.) By setting it up as a group, we can manage all the different processes as a set. Whether or not that's the

Re: Django 2.0.2, Channels 2.0.2 and Celery 4.1 Issue

2018-03-02 Thread Ken Whitesell
Taking a stab at this - I believe the original problem may be here: channel_layer.group_send( settings.CHANNEL_GROUP, {"type": "epics.message", "text": "Hello World"}, ) Your updateData method is a synchronous method. However, channel_layer.group_send is an asynchronous

Re: Channels 2.0 - Exception when sending a message to client

2018-02-25 Thread Ken Whitesell
And while we're at it, I'm going to toss out another opinion. I've found it extremely beneficial _for me_ to not try to relate channels 2.0 to channels 1.1. I'm approaching it as if I'm learning about a completely separate package - working from a clean slate so-to-speak. Ken On Sunday,

Re: Channels 2.0 - Exception when sending a message to client

2018-02-25 Thread Ken Whitesell
In so far as you are talking about background worker tasks, you are correct. But those statements do not pertain to a websocket consumer that accepts connections from a browser. You can run an application without ever creating a worker task. (Again, I'll refer you to the channels-examples app

Re: Channels 2.0 - Exception when sending a message to client

2018-02-25 Thread Ken Whitesell
Before I get to the guts of my answer, I'd suggest you get Andrew Godwin's "channels-examples" application and read it completely until you believe you understand everything that it's doing. (https://github.com/andrewgodwin/channels-examples) Now, to the extent of my understanding, the

Re: Simple Search Feature

2018-02-24 Thread Ken Whitesell
One of the issues is here: if request.method == 'GET': song_name = request.GET.get('name', "Error") songs = self.model.objects.filter(name__icontains=song_name) else: songs = self.models.all() return render(request, self.template_name,

Re: Channels 2.0 - Exception when sending a message to client

2018-02-24 Thread Ken Whitesell
I'm going to take a stab at this - with the warning that I'm extremely uncertain that I'm anywhere close to being correct, but I'm hoping that I'm at least close enough that it might give you some clues. So where I think the issue may be is that you're trying to do a "self.send" from a worker

Re: Channels worker and call_later

2018-02-23 Thread Ken Whitesell
(and remember, you > can put it on `self` if you need to keep a reference). > > To make a task, just do: > > loop = asyncio.get_event_loop() > self.task = loop.create_task(coroutine_function()) > > Hope that helps! > > Andrew > > On Fri, Feb 23, 2018 at 7:48

Channels worker and call_later

2018-02-23 Thread Ken Whitesell
TLDR: Is there a way to use the call_later function within a worker task? (Or am I just looking at this issue the wrong way?) Software - Python 3.6, Django 2.0.2, Channels 2.0.2, trying to run this on either / both Windows 10 and Ubuntu 17.10 if it matters Longer version - I'm having