Re: file fields

2017-01-26 Thread ludovic coues
If you want a fixed set of file field, you declare multiple file
field, each with a different name. For exemple:

class UserProfile(models.Model):
photo_front = models.FileField(...)
photo_side = models.FileField(...)

If you want a list of photo, you don't know yet how many, you use a
second model with a foreign key:

class UserPhoto(models.Model):
user =  models.ForeignKey(UserProfile, models.CASCADE,
related_name="photos")
photo = models.FileField(...)

With the second model, you access all the photo with
user_profile.photos.all(). If the related_name attribute on the
foreign key is "photo_set", user_profile.photo_set.all().

I hope this will help you and that I am clear enough :)

2017-01-26 0:00 GMT+01:00 ايهاب توفيق :
> I am new in django and to know how to use multiple file field in the same
> model can any one help me
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/da76e41d-1975-4371-b91d-4eedd9ba9a96%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTZY7Rn%3DWZMZ8etjg1JaG8NFv5%2BTM4WxV6Qfi_0KEH-%3D6w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Comparing two lists

2017-01-26 Thread ludovic coues
You are assuming you can have address without building.
{% if x.building %}

2017-01-26 0:27 GMT+01:00 Richard Hall :
> Hello, I've only just started with Django and need a bit of help steering
> myself in the right direction.
>
> I want to create a page that has a list of possible forms that could be
> filled in for a patient in a medical study and differentiate between those
> forms which have already been completed and those that have yet to be
> started. I have 3 tables: 'Building' which contains the list of forms,
> 'Street' which contains the list of patients and 'Address' which records
> which form exists for each patient. The relevant bit of models.py looks like
> this:
>
> class Building(models.Model):
> crf_code = models.CharField(max_length=6, primary_key=True)
> crf_name = models.CharField(max_length=100)
>
> class Street(models.Model):
> village = models.ForeignKey(Village)
> patient_number = models.PositiveIntegerField()
> initials = models.CharField(max_length=3)
>
>
> class Address(models.Model):
> street = models.ForeignKey(Street, related_name='addresses')
> building = models.ForeignKey(Building, related_name='addresses')
> completed = models.BooleanField(default=False)
>
> I've created a view that creates two lists, one of all buildings (i.e. forms
> that could be entered for a patient) and another of forms already existing,
> filtered by patient id:
>
> def street2(request, patientid):
> context_dict = {}
> try:
> address = Address.objects.filter(street__pk=patientid)
> crf = Building.objects.all()
> context_dict['address'] = address
> context_dict['crf'] = crf
> except Street.DoesNotExist:
> context_dict['address'] = None
> context_dict['crf'] = None
>
> return render(request, 'trial/street2.html', context_dict)
>
> My problem comes with relating the two lists to each other in my template.
> what I want to do is list the buildings and then, depending if the form
> already exists, display an "edit form" or "create form" link:
>
> 
> 
> {% for x in address %}
> 
> {{ x.building }}
> 
> {% if  %}
> link to edit form
> {% elif %}
> link to create form
> {% endif %}
> 
> 
> {% endfor %}
> 
> 
>
> I'm not sure if I've explained myself clearly; if not I apologize. I'm only
> just starting out and am floundering a bit. Any help or guidance would be
> hugely appreciated.
>
> Thank you,
>
> Richard
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/237bb16a-d76e-42b9-bd46-a7b2f9c43f4c%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTZ5UE9UnePyay-mApr8BiHJwygN98r8XYLDxNgTf7O9Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Comparing two lists

2017-01-26 Thread Richard Hall
Thanks for replying to my question. 

What I am trying to do is for each building in the list see if there is a 
corresponding address record for that building. Thus I'm trying to test the 
opposite of what you've pointed out i.e. not that there will be an address 
without a building, but if that building has an address.

On Thursday, 26 January 2017 19:21:18 UTC+11, ludovic coues wrote:
>
> You are assuming you can have address without building. 
> {% if x.building %} 
>
> 2017-01-26 0:27 GMT+01:00 Richard Hall >: 
>
> > Hello, I've only just started with Django and need a bit of help 
> steering 
> > myself in the right direction. 
> > 
> > I want to create a page that has a list of possible forms that could be 
> > filled in for a patient in a medical study and differentiate between 
> those 
> > forms which have already been completed and those that have yet to be 
> > started. I have 3 tables: 'Building' which contains the list of forms, 
> > 'Street' which contains the list of patients and 'Address' which records 
> > which form exists for each patient. The relevant bit of models.py looks 
> like 
> > this: 
> > 
> > class Building(models.Model): 
> > crf_code = models.CharField(max_length=6, primary_key=True) 
> > crf_name = models.CharField(max_length=100) 
> > 
> > class Street(models.Model): 
> > village = models.ForeignKey(Village) 
> > patient_number = models.PositiveIntegerField() 
> > initials = models.CharField(max_length=3) 
> > 
> > 
> > class Address(models.Model): 
> > street = models.ForeignKey(Street, related_name='addresses') 
> > building = models.ForeignKey(Building, related_name='addresses') 
> > completed = models.BooleanField(default=False) 
> > 
> > I've created a view that creates two lists, one of all buildings (i.e. 
> forms 
> > that could be entered for a patient) and another of forms already 
> existing, 
> > filtered by patient id: 
> > 
> > def street2(request, patientid): 
> > context_dict = {} 
> > try: 
> > address = Address.objects.filter(street__pk=patientid) 
> > crf = Building.objects.all() 
> > context_dict['address'] = address 
> > context_dict['crf'] = crf 
> > except Street.DoesNotExist: 
> > context_dict['address'] = None 
> > context_dict['crf'] = None 
> > 
> > return render(request, 'trial/street2.html', context_dict) 
> > 
> > My problem comes with relating the two lists to each other in my 
> template. 
> > what I want to do is list the buildings and then, depending if the form 
> > already exists, display an "edit form" or "create form" link: 
> > 
> >  
> >  
> > {% for x in address %} 
> >  
> > {{ x.building }} 
> >  
> > {% if  %} 
> > link to edit form 
> > {% elif %} 
> > link to create form 
> > {% endif %} 
> >  
> >  
> > {% endfor %} 
> >  
> >  
> > 
> > I'm not sure if I've explained myself clearly; if not I apologize. I'm 
> only 
> > just starting out and am floundering a bit. Any help or guidance would 
> be 
> > hugely appreciated. 
> > 
> > Thank you, 
> > 
> > Richard 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Django users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to django-users...@googlegroups.com . 
> > To post to this group, send email to django...@googlegroups.com 
> . 
> > Visit this group at https://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/django-users/237bb16a-d76e-42b9-bd46-a7b2f9c43f4c%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
>
> Cordialement, Coues Ludovic 
> +336 148 743 42 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0ea9674b-caef-479a-a51e-3b6e544615d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Comparing two lists

2017-01-26 Thread Richard Hall
Thanks for replying, I need all the help I can get. What I'm trying to do 
is the opposite of what I seem to be doing. Rather than looking for an 
address without a building I am trying to see, from my list of all 
buildings, which one has an address (filtered by patientid). I can easily 
list all addresses associated with a building, it is just getting only the 
ones for a particular patient that I'm stuck with.

Thanks,

Richard

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0ec5c059-a0b3-41ab-8f42-2603e0d640e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Comparing two lists

2017-01-26 Thread ludovic coues
Building.objects.filter(addresses__street__pk=patientid) will return
all buildings with an address in the same street as the patient. If I
understand correctly, that is :)

2017-01-26 10:41 GMT+01:00 Richard Hall :
> Thanks for replying, I need all the help I can get. What I'm trying to do is
> the opposite of what I seem to be doing. Rather than looking for an address
> without a building I am trying to see, from my list of all buildings, which
> one has an address (filtered by patientid). I can easily list all addresses
> associated with a building, it is just getting only the ones for a
> particular patient that I'm stuck with.
>
> Thanks,
>
> Richard
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0ec5c059-a0b3-41ab-8f42-2603e0d640e5%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTZP_XHQYeHJ9_FQGCBrn8S%2Bt3zfMbyf%2BHR4F8-02CsWzg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django channels on IIS

2017-01-26 Thread Avraham Serour
if you are stuck on windows but not necessarily IIS you may try cygwin, I
once had to deploy on windows and after investigating some possibilities I
just installed cygwin and put nginx with uwsgi.

On Thu, Jan 26, 2017 at 9:55 AM, Алексей Кузуб  wrote:

> Thank you for your answers and advices. I have no possibility to use *nix
> platform, my employer wants it on IIS. I'll try to build it, thank you very
> much!
>
> среда, 25 января 2017 г., 21:14:22 UTC+3 пользователь Jani Tiainen написал:
>>
>> There exists 3rd party ASGI handler for IIS: https://github.com/mjkill
>> ough/iis-asgi-handler/
>>
>> It also requires at least IIS 8 and websocket protocol installed. More
>> details at https://www.iis.net/learn/get-started/whats-new-in-iis-8/
>> iis-80-websocket-protocol-support
>>
>> Note, you need to build that handler yourself, which then requires
>> another set of tools, visual studio 2015 and CMake 2.8+
>>
>> Also note that there is not much of installation instructions or how to
>> build package that you can just install to your server without installing
>> all the development tools there.
>>
>> I really suggest that you try to find some *nix platform to run required
>> parts, it's just plain simpler and more documented than IIS.
>>
>> On Wed, Jan 25, 2017 at 7:25 PM, Andrew Godwin 
>> wrote:
>>
>>> Hi,
>>>
>>> I am afraid I don't have experience using IIS - I don't know if it even
>>> supports HTTP/1.1 proxying, which is needed for WebSockets. Hopefully
>>> someone else can help.
>>>
>>> Andrew
>>>
>>> On Wed, Jan 25, 2017 at 6:35 AM, Алексей Кузуб 
>>> wrote:
>>>
 I have a project in Django and i want to use django channels for
 support websockets in my project, but i have a problem with IIS
 configuration. Could somebody helps me with configuration daphne in IIS or
 configuration IIS to support channels and daphne. Has somebody any
 expierence in it? And maybe somebody knows some ways to deploy
 django+channels on IIS with or without daphne?
 Sorry for my bad english.

 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users...@googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit https://groups.google.com/d/ms
 gid/django-users/9364bca2-2a03-4ae7-b93b-ff105ff34d31%40goog
 legroups.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/CAFwN1urM2A4HBhPzbG4_Tgs_DKzab39-Pz_
>>> jzWa981AGfC0cYg%40mail.gmail.com
>>> 
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Jani Tiainen
>>
>> - Well planned is half done, and a half done has been sufficient before...
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/636597f8-5b05-403a-b118-e5e84a841b19%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFWa6tJ5QM-DdcGnn_rAdFK6CKF7%3DaPqmvxtK4g0Qb_ELpWBFA%40mail.gmail.com.
For more options, visit https://grou

Re: Multiple forms in the same template

2017-01-26 Thread schaf . mh
Ohh thanks that helped a lot.
Now in one view I still have a problem.
It uses the a formset and tries to give that back while overwriting the 
get_form function:

views.py
class LayoutFormView(LoginRequiredMixin, StaffuserRequiredMixin, UpdateView
):
template_name = 'abc/layout.html'
form_class = LayoutFormSet
breadcrumbs = ['config_list']

def form_valid(self, form):
if 'save' in self.request.POST.keys():
layout_change_settings(form=form, **kwargs)
return HttpResponseRedirect(self.get_success_url())

elif 'reset_to_default' in self.request.POST.keys():
layout_reset_to_default(form=form, **kwargs)
return HttpResponseRedirect(reverse('update_layout', kwargs={
'pk': self.kwargs['pk']}))

def get_object(self, queryset=None):
return LayoutSet.objects.get(settings__pk=self.kwargs['pk'])

def get_context_data(self, **kwargs):
context = super(LayoutFormView, self).get_context_data(**kwargs)

if self.object.label not in ['default']:
context['label'] = "custom"
else:
context['label'] = self.object.label

return context

def get_success_url(self):
return reverse('update_layout', kwargs={'pk': self.kwargs['pk']})

def get_form(self, form_class=None):
if self.request.POST:
return form_class(self.request.POST)
else:
initial = [{'param': 'abc',
'choosen': 'None'}]
return form_class(initial=initial)

forms.py
class LayoutForm(forms.Form):
def __init__(self, *args, **kwargs):
super(LayoutForm, self).__init__(*args, **kwargs)

param = forms.CharField()
choosen = forms.BooleanField()

class Meta:
fields = ['choosen']

def is_valid(self):
return True

LayoutFormSet = formset_factory(LayoutForm, extra=0)


According to my understanding this does not work, because a formset is 
assigned to the form_class attribute.
It is not possible to determine the form in the base get_form, because a 
formset is assigned.

I would add the formset in the context and then use it in the template. I 
still seem to have a problem after saving, but I guess this is releated 
with the improper use of the formset.

Thanks for hints.
schaf



Am Mittwoch, 25. Januar 2017 12:19:55 UTC+1 schrieb Melvyn Sopacua:
>
> On Tuesday 24 January 2017 05:07:25 scha...@gmail.com  wrote:
>
> > sorry I wanted to shorten the code before, to not post too much.
>
> > Here the code:
>
> > 
>
> > views.py
>
> > class MFormsView(LoginRequiredMixin, StaffuserRequiredMixin,
>
> > UpdateView, MFView):
>
>  
>
> And there you have it:
>
> MFormsView uses UpdateView 
> 
>  
> which pulls in ModelFormMixin. So this view needs a fields attribute:
>
>  
>
> class M MFormsView(LoginRequiredMixin, StaffuserRequiredMixin, UpdateView, 
> MFView):
>
> fields = ['foo', 'bar', 'baz']
>
>  
>
>  
>
> -- 
>
> Melvyn Sopacua
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/95dc47c1-432d-4181-b605-f714159ae278%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Comparing two lists

2017-01-26 Thread Melvyn Sopacua
Hello,

I don't know if you've changed names to protect the innocent, but conceptually, 
these 
models are hard to translate to the real world. This is the opposite of what 
object 
oriented programming is trying to accomplish and probably why you're having a 
hard 
time figuring it out and explaining to others.

For example, it makes no sense that a street has a patient number and initials. 
Address should be a through model for a ManyToManyField on Building (if we're 
talking 
buildings, addresses and streets and ignore patients), but then "completed" 
isn't a 
good way to distinguish between "23 Main Road" and "25 Main Road".

You get the idea...

>From the looks of it, you altered your code (street_pk=patientid should not 
>work as 
you think, as patient_number is not the pk of Street). If you do that - please 
use an 
anology that makes sense, possibly using the classics like fruits, books and 
pizzatoppings.

On Wednesday 25 January 2017 15:27:00 Richard Hall wrote:

> My problem comes with relating the two lists to each other in my
> template. what I want to do is list the buildings and then, depending
> if the form already exists, display an "edit form" or "create form"
> link:
> 
> 
> 
> {% for x in address %}

But...You're not listing buildings. You're listing addresses. So all buildings 
that come up, 
exist.
Figuring out the buildings "owned by" the patient which don't have addresses, 
you 
should iterate the buildings and inspect the addresses attribute. For ease of 
use in 
template, one could do this:

class Building(models.Model):
# 
@property
def has_address_for_patient(self):
return hasattr(self, 'addresses') and \

self.addresses.filter(street__pk=patientid).count() > 0

Remember that Django Template Language strives to keep programming out of the 
template, so either do the above in your model or in your view when building 
the 
context.
-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3384291.oJKR40FGvU%40devstation.
For more options, visit https://groups.google.com/d/optout.


Re: Django-channels and JSON-RPC

2017-01-26 Thread Fabien Millerand
Alexander,

What I am working on is not the client, but the server...
I am not really sure what you are looking for exactly, but I have been 
working with websockets and json-rpc client-server structure for a few 
years now, so happy to fill you in with some infos if needed.




Le mercredi 25 janvier 2017 11:59:06 UTC+1, Alexander Prokhorov a écrit :
>
> Colleagues,
>
> you are really fast :) How can I help you? For our project we will 
> definitely need a JavaScript client. Quick googling led me to 
> https://github.com/JsCommunity/jsonrpc-websocket-client it does not look 
> mature, but such client is quite easy to implement. Do you have plans to 
> include simple JavaScript client to the package? If so I could try to start 
> doing one right now.
>
> среда, 25 января 2017 г., 11:57:35 UTC+3 пользователь Fabien Millerand 
> написал:
>>
>> Fair enough. I understand that in distributed system. But maybe you 
>> should add a note about that, as if the whole system is not distributed 
>> over network(s), it is highly unlikely to lose frames :D
>>
>>
>>
>> On 25 Jan 2017, at 09:08, Andrew Godwin  wrote:
>>
>> Yes, it's a bit alarmist if you don't come from the background of writing 
>> distributed systems. I just don't like to hide the truth one bit!
>>
>> All your software and hardware can fail in myriad ways; I have a talk I 
>> need to give about it at some point. Knowing how it fails is half the 
>> battle!
>>
>> Andrew
>>
>> On Wed, Jan 25, 2017 at 12:06 AM, Fabien Millerand  
>> wrote:
>>
>>> Ok, I start to understand now.
>>> To be frank the docs are a bit alarming :) 
>>>
>>>
>>>
>>> Le mercredi 25 janvier 2017 08:47:06 UTC+1, Andrew Godwin a écrit :


>> I am not sure to understand. In which case can there be 
> messages/frames lost?! Where does that happen? Between the server 
> interface 
> and the Django layer? I would need to know more about that... Otherwise I 
> might need to move with uWSGI or something JSON-RPC in itself doesn't 
> implement a timeout, althought the javascript client better have one...
>
>
 It simply means that it's possible that you might lose an incoming 
 frame. This is also true of implementing it in uWSGI (the process handling 
 the socket might get OOM killed, or the server might die, etc.)

 It's not a normal case, it's just that if something super bad happens, 
 the resulting handling is to drop a message rather than play it twice. 
 Most 
 systems I know of that handle websockets do this.

 Andrew 

>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/97e75375-6caf-4e8d-a781-be6da421840d%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/django-users/b00Ie8wBPnc/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> django-users...@googlegroups.com.
>> To post to this group, send email to django...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAFwN1uoPw%2BTjz3dmTvLeOck%3DHfRfRycA%3DHZ_GQa%2BbYBt7oXxwA%40mail.gmail.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/58235bfb-2aae-47bd-bd7a-fc4baa98a11d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-channels and JSON-RPC

2017-01-26 Thread Fabien Millerand
Andrew,

I have finished to develop what I called the JsonRpcWebsocketConsumer:

https://github.com/millerf/django-channels-jsonrpc/tree/master/django_channels_jsonrpc/django_channels_jsonrpc

I was thinking of creating a pypy package, there is a little bit f more 
work to be done for that. But if you want it for your next release it is 
pretty much standalone. There is an example provided and plenty of tests.

Let me know what you guys think, and if you see anything to be 
modified/added.

Cheers.

Le mercredi 25 janvier 2017 09:09:48 UTC+1, Andrew Godwin a écrit :
>
> Yes, it's a bit alarmist if you don't come from the background of writing 
> distributed systems. I just don't like to hide the truth one bit!
>
> All your software and hardware can fail in myriad ways; I have a talk I 
> need to give about it at some point. Knowing how it fails is half the 
> battle!
>
> Andrew
>
> On Wed, Jan 25, 2017 at 12:06 AM, Fabien Millerand  > wrote:
>
>> Ok, I start to understand now.
>> To be frank the docs are a bit alarming :) 
>>
>>
>>
>> Le mercredi 25 janvier 2017 08:47:06 UTC+1, Andrew Godwin a écrit :
>>>
>>>
> I am not sure to understand. In which case can there be 
 messages/frames lost?! Where does that happen? Between the server 
 interface 
 and the Django layer? I would need to know more about that... Otherwise I 
 might need to move with uWSGI or something JSON-RPC in itself doesn't 
 implement a timeout, althought the javascript client better have one...


>>> It simply means that it's possible that you might lose an incoming 
>>> frame. This is also true of implementing it in uWSGI (the process handling 
>>> the socket might get OOM killed, or the server might die, etc.)
>>>
>>> It's not a normal case, it's just that if something super bad happens, 
>>> the resulting handling is to drop a message rather than play it twice. Most 
>>> systems I know of that handle websockets do this.
>>>
>>> Andrew 
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/97e75375-6caf-4e8d-a781-be6da421840d%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/49dbc038-46e5-402c-a810-900d47a561bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: audit trail functionality in database model

2017-01-26 Thread enrico baranski
@Fred: Thanks a lot, that really helped me! 

enrico

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/93d2fa48-adcf-4070-bee2-4aecda830c51%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Comparing two lists

2017-01-26 Thread Richard Hall
Melvyn, thanks for looking at this. Despite my inept attempt at explanation 
you've understood what I am trying to do - I need to revisit my 
relationships and fully explore my options at the model level.

Thanks again,

Richard

P.S. I'll try to use clearer analogies in the future - in my head the 
database is a village which is really obvious, but only if you are in my 
head!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9f132096-e397-42fd-8d8e-31f7c64a2bfa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-channels and JSON-RPC

2017-01-26 Thread Andrew Godwin
A quick read through and it looks roughly how I expect; I'm not an expert
in JSON-RPC though so I'd want some other people to chime in.

As for releasing it on PyPI, I think that's the best way; I don't want to
roll something like this into Channels directly. I would suggest you turn
it from a Django app into a simple Python module though, so you can just do:


from channels_jsonrpc import JsonRpcWebsocketConsumer

class MyConsumer(JsonRpcWebsocketConsumer):
   


In your own consumers file.

Andrew

On Thu, Jan 26, 2017 at 12:14 PM, Fabien Millerand 
wrote:

> Andrew,
>
> I have finished to develop what I called the JsonRpcWebsocketConsumer:
>
> https://github.com/millerf/django-channels-jsonrpc/tree/
> master/django_channels_jsonrpc/django_channels_jsonrpc
>
> I was thinking of creating a pypy package, there is a little bit f more
> work to be done for that. But if you want it for your next release it is
> pretty much standalone. There is an example provided and plenty of tests.
>
> Let me know what you guys think, and if you see anything to be
> modified/added.
>
> Cheers.
>
> Le mercredi 25 janvier 2017 09:09:48 UTC+1, Andrew Godwin a écrit :
>>
>> Yes, it's a bit alarmist if you don't come from the background of writing
>> distributed systems. I just don't like to hide the truth one bit!
>>
>> All your software and hardware can fail in myriad ways; I have a talk I
>> need to give about it at some point. Knowing how it fails is half the
>> battle!
>>
>> Andrew
>>
>> On Wed, Jan 25, 2017 at 12:06 AM, Fabien Millerand 
>> wrote:
>>
>>> Ok, I start to understand now.
>>> To be frank the docs are a bit alarming :)
>>>
>>>
>>>
>>> Le mercredi 25 janvier 2017 08:47:06 UTC+1, Andrew Godwin a écrit :


>> I am not sure to understand. In which case can there be
> messages/frames lost?! Where does that happen? Between the server 
> interface
> and the Django layer? I would need to know more about that... Otherwise I
> might need to move with uWSGI or something JSON-RPC in itself doesn't
> implement a timeout, althought the javascript client better have one...
>
>
 It simply means that it's possible that you might lose an incoming
 frame. This is also true of implementing it in uWSGI (the process handling
 the socket might get OOM killed, or the server might die, etc.)

 It's not a normal case, it's just that if something super bad happens,
 the resulting handling is to drop a message rather than play it twice. Most
 systems I know of that handle websockets do this.

 Andrew

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/97e75375-6caf-4e8d-a781-be6da421840d%40googlegroups.com
>>> 
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/49dbc038-46e5-402c-a810-900d47a561bf%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFwN1upCc96mWBP7ZCZm9y26ZJu7YRL7Q%3DvrxXOL43xx5Zc1gA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django channels deployment

2017-01-26 Thread Sgiath
Hi I am working on some app with Django Channels and I am in the phase when 
I am looking for the best way how to deploy the Channel project (with 
scaling and smooth update in mind).
I have this setup:

   1. Nginx server handling SSL certificate, headers, etc. it will proxy to 
   ->
   2. Daphne server - question: *I can run Daphne with just two files 
   - asgi.py and settings.py (which will match the Django app settings)?*
   3. Redis Channel backend server
   4. Redis Cache server
   5. MySQL database
   6. Server with actual Django code running the workers (few for http.* 
   few for websocket.* channels and few universal).

If I would like to scale I can:

   - Run multiple Daphne servers and load-balance them on the Nginx server
   - Run multiple Redis Channel servers in one shard
   - Run multiple servers with workers

If I would like to update to the new Django code:

   - Just load new code on the worker servers and restart the workers (in 
   case I wouldn't change the CHANNEL_LAYERS settings).

Will it work? Are there the only three conditions? 1. All Daphne servers 
has to see the Redis, and all workers has to see the Redis too. 2. The 
Redis has to looks like one instance. 3. Daphne and workers has to have the 
same CHANNEL_LAYERS settings.

Right now I am in the proof of concept phase and I all test it with the 
docker-compose (every part in my architecture is separate Docker image) and 
it is working (only difference is that I am running Daphne and workers on 
the same machine but I am in the middle of separate them) but I want to be 
sure that it will work on actual separate servers (I want to use Google 
Cloud platform) before I will present this idea to my boss :) .

Thanks for your help
*Sgiath*

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c1eac5c2-b359-4e67-96a8-86fba12f9a07%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Multiple (limited) Admin feature for each registered user - Best Approach.

2017-01-26 Thread Mike08
Hello experts first time poster here, so I am not sure how to approach this 
issue. I am trying to restrict admin privileges of users.
Let me explain a simple use case and then I could explain my objective. 
Consider the following example (model code below) there are 3 
subjects(Subject Model) in the database suppose these are (Math , physics , 
chemistry)
Now each teacher (Teacher model) is assigned a Subject (subject Model). Now 
each Teacher should have an admin section they should not be able to change 
their name, they should not be able to change their subject but they can 
create new topics that they would like to discuss in their class(Topic 
Model). My question is what would be the best approach to handle this. 

Example:

*class Subject(models.Model):*
*name = models.CharField(max_length=200)*
*text   = models.CharField(max_length=200)*

*class Topic(models.Model)*
*topic_name = models.CharField(max_length=200)*

*class Teacher(models.Model):*
*name = models.CharField(max_length=200)*
*subject= models.ForeignKey('Subject')*
*topic= models.ForeignKey('Subject')*
*text = models.TextField()*


Now inorder to handle this should I create a separate admin for the 
teachers (like below )? If so how do I limit the models they should not be 
able to see other teachers in the system. Only themselves ?


*from django.contrib.admin.sites import AdminSite*

*class TeacherAdminSite(AdminSite):*
*pass*
*#or overwrite some methods for different functionality*

*teachAdmin= TeacherAdminSite(name="teachadmin") *



Any suggestions on how I could solve this problem ? Or any other approach 
that I can take ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d583599d-2942-48bc-aa5e-5674a6532544%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-channels and JSON-RPC

2017-01-26 Thread Fabien Millerand
Yes, that was my thought as well...

Will do and let you know. It could be good to add a link in your docs  as a
side note...

If you get any feedback let me know...

El 26 ene. 2017 22:38, "Andrew Godwin"  escribió:

> A quick read through and it looks roughly how I expect; I'm not an expert
> in JSON-RPC though so I'd want some other people to chime in.
>
> As for releasing it on PyPI, I think that's the best way; I don't want to
> roll something like this into Channels directly. I would suggest you turn
> it from a Django app into a simple Python module though, so you can just do:
>
>
> from channels_jsonrpc import JsonRpcWebsocketConsumer
>
> class MyConsumer(JsonRpcWebsocketConsumer):
>
>
>
> In your own consumers file.
>
> Andrew
>
> On Thu, Jan 26, 2017 at 12:14 PM, Fabien Millerand 
> wrote:
>
>> Andrew,
>>
>> I have finished to develop what I called the JsonRpcWebsocketConsumer:
>>
>> https://github.com/millerf/django-channels-jsonrpc/tree/mast
>> er/django_channels_jsonrpc/django_channels_jsonrpc
>>
>> I was thinking of creating a pypy package, there is a little bit f more
>> work to be done for that. But if you want it for your next release it is
>> pretty much standalone. There is an example provided and plenty of tests.
>>
>> Let me know what you guys think, and if you see anything to be
>> modified/added.
>>
>> Cheers.
>>
>> Le mercredi 25 janvier 2017 09:09:48 UTC+1, Andrew Godwin a écrit :
>>>
>>> Yes, it's a bit alarmist if you don't come from the background of
>>> writing distributed systems. I just don't like to hide the truth one bit!
>>>
>>> All your software and hardware can fail in myriad ways; I have a talk I
>>> need to give about it at some point. Knowing how it fails is half the
>>> battle!
>>>
>>> Andrew
>>>
>>> On Wed, Jan 25, 2017 at 12:06 AM, Fabien Millerand 
>>> wrote:
>>>
 Ok, I start to understand now.
 To be frank the docs are a bit alarming :)



 Le mercredi 25 janvier 2017 08:47:06 UTC+1, Andrew Godwin a écrit :
>
>
>>> I am not sure to understand. In which case can there be
>> messages/frames lost?! Where does that happen? Between the server 
>> interface
>> and the Django layer? I would need to know more about that... Otherwise I
>> might need to move with uWSGI or something JSON-RPC in itself doesn't
>> implement a timeout, althought the javascript client better have one...
>>
>>
> It simply means that it's possible that you might lose an incoming
> frame. This is also true of implementing it in uWSGI (the process handling
> the socket might get OOM killed, or the server might die, etc.)
>
> It's not a normal case, it's just that if something super bad happens,
> the resulting handling is to drop a message rather than play it twice. 
> Most
> systems I know of that handle websockets do this.
>
> Andrew
>
 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users...@googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit https://groups.google.com/d/ms
 gid/django-users/97e75375-6caf-4e8d-a781-be6da421840d%40goog
 legroups.com
 
 .

 For more options, visit https://groups.google.com/d/optout.

>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/49dbc038-46e5-402c-a810-900d47a561bf%40googlegroups.com
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/b00Ie8wBPnc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> 

Re: Django channels deployment

2017-01-26 Thread Andrew Godwin
Hi,

Yes, you can run daphne with just an ASGI file that matches the Django
settings. It's easier to just use the Django project for this, but you also
don't need to update/restart it unless the CHANNEL_LAYERS setting changes.

The conditions you put down are mostly correct, apart from 2), having one
redis instance. You can supply the Redis channel layer with multiple Redis
hostnames and it will automatically shard between them - however, if you do
this you must have enough workers to consume from all of the shards or you
may miss messages. I recommend sticking with one for now, as a single Redis
can handle a LOT of throughput. You also can't use redis-cluster, as it
doesn't support some of the operations we use (like BLPOP)

Andrew

On Thu, Jan 26, 2017 at 1:27 PM, Sgiath  wrote:

> Hi I am working on some app with Django Channels and I am in the phase
> when I am looking for the best way how to deploy the Channel project (with
> scaling and smooth update in mind).
> I have this setup:
>
>1. Nginx server handling SSL certificate, headers, etc. it will proxy
>to ->
>2. Daphne server - question: *I can run Daphne with just two files
>- asgi.py and settings.py (which will match the Django app settings)?*
>3. Redis Channel backend server
>4. Redis Cache server
>5. MySQL database
>6. Server with actual Django code running the workers (few for http.*
>few for websocket.* channels and few universal).
>
> If I would like to scale I can:
>
>- Run multiple Daphne servers and load-balance them on the Nginx server
>- Run multiple Redis Channel servers in one shard
>- Run multiple servers with workers
>
> If I would like to update to the new Django code:
>
>- Just load new code on the worker servers and restart the workers (in
>case I wouldn't change the CHANNEL_LAYERS settings).
>
> Will it work? Are there the only three conditions? 1. All Daphne servers
> has to see the Redis, and all workers has to see the Redis too. 2. The
> Redis has to looks like one instance. 3. Daphne and workers has to have the
> same CHANNEL_LAYERS settings.
>
> Right now I am in the proof of concept phase and I all test it with the
> docker-compose (every part in my architecture is separate Docker image)
> and it is working (only difference is that I am running Daphne and workers
> on the same machine but I am in the middle of separate them) but I want to
> be sure that it will work on actual separate servers (I want to use Google
> Cloud platform) before I will present this idea to my boss :) .
>
> Thanks for your help
> *Sgiath*
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/c1eac5c2-b359-4e67-96a8-86fba12f9a07%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFwN1urvQ0yf2GG15xrocSnyRVhwrkaX8kvQuL0Edz30c-9aWw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django channels deployment

2017-01-26 Thread Sgiath
And if I would like to separate some of the infrastructure - for example 
dedicate some resources just for one customer. Can I run some workers for 
the request based on the, for example, path?

Example:
I want 10 workers consume just messages from path example.com/customer1 and 
all messages from example.com/customer1 will be consumed by those 10 
workers.

I guess I can separate the interfaces servers - I will filter it on the 
Nginx server.
Can I also run (in the distance future with millions of requests :) ) 
separate Redis server for the 1 customer? Can I dedicate some workers and 
interface servers to just talk to specific Redis server?

On Thursday, January 26, 2017 at 11:10:24 PM UTC+1, Andrew Godwin wrote:
>
> Hi,
>
> Yes, you can run daphne with just an ASGI file that matches the Django 
> settings. It's easier to just use the Django project for this, but you also 
> don't need to update/restart it unless the CHANNEL_LAYERS setting changes.
>
> The conditions you put down are mostly correct, apart from 2), having one 
> redis instance. You can supply the Redis channel layer with multiple Redis 
> hostnames and it will automatically shard between them - however, if you do 
> this you must have enough workers to consume from all of the shards or you 
> may miss messages. I recommend sticking with one for now, as a single Redis 
> can handle a LOT of throughput. You also can't use redis-cluster, as it 
> doesn't support some of the operations we use (like BLPOP)
>
> Andrew
>
> On Thu, Jan 26, 2017 at 1:27 PM, Sgiath > 
> wrote:
>
>> Hi I am working on some app with Django Channels and I am in the phase 
>> when I am looking for the best way how to deploy the Channel project (with 
>> scaling and smooth update in mind).
>> I have this setup:
>>
>>1. Nginx server handling SSL certificate, headers, etc. it will proxy 
>>to ->
>>2. Daphne server - question: *I can run Daphne with just two files 
>>- asgi.py and settings.py (which will match the Django app settings)?*
>>3. Redis Channel backend server
>>4. Redis Cache server
>>5. MySQL database
>>6. Server with actual Django code running the workers (few for http.* 
>>few for websocket.* channels and few universal).
>>
>> If I would like to scale I can:
>>
>>- Run multiple Daphne servers and load-balance them on the Nginx 
>>server
>>- Run multiple Redis Channel servers in one shard
>>- Run multiple servers with workers
>>
>> If I would like to update to the new Django code:
>>
>>- Just load new code on the worker servers and restart the workers 
>>(in case I wouldn't change the CHANNEL_LAYERS settings).
>>
>> Will it work? Are there the only three conditions? 1. All Daphne servers 
>> has to see the Redis, and all workers has to see the Redis too. 2. The 
>> Redis has to looks like one instance. 3. Daphne and workers has to have the 
>> same CHANNEL_LAYERS settings.
>>
>> Right now I am in the proof of concept phase and I all test it with the 
>> docker-compose (every part in my architecture is separate Docker image) 
>> and it is working (only difference is that I am running Daphne and workers 
>> on the same machine but I am in the middle of separate them) but I want to 
>> be sure that it will work on actual separate servers (I want to use Google 
>> Cloud platform) before I will present this idea to my boss :) .
>>
>> Thanks for your help
>> *Sgiath*
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/c1eac5c2-b359-4e67-96a8-86fba12f9a07%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d6376196-ce62-4bf1-8094-4032b525fdb3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django channels deployment

2017-01-26 Thread Andrew Godwin
You can separate workers by channel name, but not by path. You're probably
better off doing it further upstream with nginx as you said.

You also can't just run one redis server per customer unless you move to
separate installs for bigger customers, with their own Daphne, Redis and
workers.

Andrew

On Thu, Jan 26, 2017 at 2:35 PM, Sgiath  wrote:

> And if I would like to separate some of the infrastructure - for example
> dedicate some resources just for one customer. Can I run some workers for
> the request based on the, for example, path?
>
> Example:
> I want 10 workers consume just messages from path example.com/customer1
> and all messages from example.com/customer1 will be consumed by those 10
> workers.
>
> I guess I can separate the interfaces servers - I will filter it on the
> Nginx server.
> Can I also run (in the distance future with millions of requests :) )
> separate Redis server for the 1 customer? Can I dedicate some workers and
> interface servers to just talk to specific Redis server?
>
> On Thursday, January 26, 2017 at 11:10:24 PM UTC+1, Andrew Godwin wrote:
>>
>> Hi,
>>
>> Yes, you can run daphne with just an ASGI file that matches the Django
>> settings. It's easier to just use the Django project for this, but you also
>> don't need to update/restart it unless the CHANNEL_LAYERS setting changes.
>>
>> The conditions you put down are mostly correct, apart from 2), having one
>> redis instance. You can supply the Redis channel layer with multiple Redis
>> hostnames and it will automatically shard between them - however, if you do
>> this you must have enough workers to consume from all of the shards or you
>> may miss messages. I recommend sticking with one for now, as a single Redis
>> can handle a LOT of throughput. You also can't use redis-cluster, as it
>> doesn't support some of the operations we use (like BLPOP)
>>
>> Andrew
>>
>> On Thu, Jan 26, 2017 at 1:27 PM, Sgiath  wrote:
>>
>>> Hi I am working on some app with Django Channels and I am in the phase
>>> when I am looking for the best way how to deploy the Channel project (with
>>> scaling and smooth update in mind).
>>> I have this setup:
>>>
>>>1. Nginx server handling SSL certificate, headers, etc. it will
>>>proxy to ->
>>>2. Daphne server - question: *I can run Daphne with just two files
>>>- asgi.py and settings.py (which will match the Django app settings)?*
>>>3. Redis Channel backend server
>>>4. Redis Cache server
>>>5. MySQL database
>>>6. Server with actual Django code running the workers (few for http.*
>>>few for websocket.* channels and few universal).
>>>
>>> If I would like to scale I can:
>>>
>>>- Run multiple Daphne servers and load-balance them on the Nginx
>>>server
>>>- Run multiple Redis Channel servers in one shard
>>>- Run multiple servers with workers
>>>
>>> If I would like to update to the new Django code:
>>>
>>>- Just load new code on the worker servers and restart the workers
>>>(in case I wouldn't change the CHANNEL_LAYERS settings).
>>>
>>> Will it work? Are there the only three conditions? 1. All Daphne servers
>>> has to see the Redis, and all workers has to see the Redis too. 2. The
>>> Redis has to looks like one instance. 3. Daphne and workers has to have the
>>> same CHANNEL_LAYERS settings.
>>>
>>> Right now I am in the proof of concept phase and I all test it with the
>>> docker-compose (every part in my architecture is separate Docker image)
>>> and it is working (only difference is that I am running Daphne and workers
>>> on the same machine but I am in the middle of separate them) but I want to
>>> be sure that it will work on actual separate servers (I want to use Google
>>> Cloud platform) before I will present this idea to my boss :) .
>>>
>>> Thanks for your help
>>> *Sgiath*
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/c1eac5c2-b359-4e67-96a8-86fba12f9a07%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web v

Re: Multiple (limited) Admin feature for each registered user - Best Approach.

2017-01-26 Thread Mike08
Quick Fix  - The Teacher model had a typo. Here is the fix

*class Teacher(models.Model):*
*name = models.CharField(max_length=200)*
*subject= models.ForeignKey('Subject')*
*topic= models.ForeignKey('**Topic**')*
*text = models.TextField()*

*What I am trying to do or (would like to do) is allow a bunch of users the 
ability to modify certain objects . Something exactly like the admin 
interface , however limiting the changes they can make to an object.*
 

On Thursday, January 26, 2017 at 1:58:57 PM UTC-8, Mike08 wrote:
>
> Hello experts first time poster here, so I am not sure how to approach 
> this issue. I am trying to restrict admin privileges of users.
> Let me explain a simple use case and then I could explain my objective. 
> Consider the following example (model code below) there are 3 
> subjects(Subject Model) in the database suppose these are (Math , physics , 
> chemistry)
> Now each teacher (Teacher model) is assigned a Subject (subject Model). 
> Now each Teacher should have an admin section they should not be able to 
> change their name, they should not be able to change their subject but they 
> can create new topics that they would like to discuss in their class(Topic 
> Model). My question is what would be the best approach to handle this. 
>
> Example:
>
> *class Subject(models.Model):*
> *name = models.CharField(max_length=200)*
> *text   = models.CharField(max_length=200)*
>
> *class Topic(models.Model)*
> *topic_name = models.CharField(max_length=200)*
>
> *class Teacher(models.Model):*
> *name = models.CharField(max_length=200)*
> *subject= models.ForeignKey('Subject')*
> *topic= models.ForeignKey('Subject')*
> *text = models.TextField()*
>
>
> Now inorder to handle this should I create a separate admin for the 
> teachers (like below )? If so how do I limit the models they should not be 
> able to see other teachers in the system. Only themselves ?
>
>
> *from django.contrib.admin.sites import AdminSite*
>
> *class TeacherAdminSite(AdminSite):*
> *pass*
> *#or overwrite some methods for different functionality*
>
> *teachAdmin= TeacherAdminSite(name="teachadmin") *
>
>
>
> Any suggestions on how I could solve this problem ? Or any other approach 
> that I can take ?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d51c083a-af63-4504-a902-04a46ef0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multiple (limited) Admin feature for each registered user - Best Approach.

2017-01-26 Thread Melvyn Sopacua
On Thursday 26 January 2017 12:10:07 Mike08 wrote:

> Now each teacher (Teacher model) is assigned a Subject (subject
> Model). Now each Teacher should have an admin section they should not
> be able to change their name, they should not be able to change their
> subject but they can create new topics that they would like to
> discuss in their class(Topic Model). My question is what would be the
> best approach to handle this.
> 
> Example:
> 
> *class Subject(models.Model):*
> *name = models.CharField(max_length=200)*
> *text   = models.CharField(max_length=200)*
> 
> *class Topic(models.Model)*
> *topic_name = models.CharField(max_length=200)*
> 
> *class Teacher(models.Model):*
> *name = models.CharField(max_length=200)*
> *subject= models.ForeignKey('Subject')*
> *topic= models.ForeignKey('Subject')*
> *text = models.TextField()*
> 

This is explained in the docs, but tucked away[1]. Also review the contrib.auth 
part 
about Permissions and Authorization[2].
In short, by creating the proper groups and sticking the users in there, one 
can assign 
the basic CRUD permissions per object.
Finer-grained control can be achieved with custom permissions[3] and the 
user_passes_test decorator[4].
-- 
Melvyn Sopacua


[1] 
https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#django.contrib.admin.Mode
lAdmin.has_change_permission
[2] 
https://docs.djangoproject.com/en/1.10/topics/auth/default/#permissions-and-authorization
[3] 
https://docs.djangoproject.com/en/1.10/topics/auth/customizing/#custom-permissions
[4] 
https://docs.djangoproject.com/en/1.10/topics/auth/default/#limiting-access-to-logged-in-users-that-pass-a-test

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/11011795.Mc3Qptr46z%40devstation.
For more options, visit https://groups.google.com/d/optout.


Re: Django-channels and JSON-RPC

2017-01-26 Thread Alexander Prokhorov
Dear Colleagues,

I've made some fixes in the code (most of them concerns Python 3 
compatibility). I also added a test showing a problem with some kind of 
name clash. 

пятница, 27 января 2017 г., 1:07:38 UTC+3 пользователь Fabien Millerand 
написал:
>
> Yes, that was my thought as well...
>
> Will do and let you know. It could be good to add a link in your docs  as 
> a side note...
>
> If you get any feedback let me know...
>
> El 26 ene. 2017 22:38, "Andrew Godwin" > 
> escribió:
>
>> A quick read through and it looks roughly how I expect; I'm not an expert 
>> in JSON-RPC though so I'd want some other people to chime in.
>>
>> As for releasing it on PyPI, I think that's the best way; I don't want to 
>> roll something like this into Channels directly. I would suggest you turn 
>> it from a Django app into a simple Python module though, so you can just do:
>>
>>
>> from channels_jsonrpc import JsonRpcWebsocketConsumer
>>
>> class MyConsumer(JsonRpcWebsocketConsumer):
>>
>>
>>
>> In your own consumers file.
>>
>> Andrew
>>
>> On Thu, Jan 26, 2017 at 12:14 PM, Fabien Millerand > > wrote:
>>
>>> Andrew,
>>>
>>> I have finished to develop what I called the JsonRpcWebsocketConsumer:
>>>
>>>
>>> https://github.com/millerf/django-channels-jsonrpc/tree/master/django_channels_jsonrpc/django_channels_jsonrpc
>>>
>>> I was thinking of creating a pypy package, there is a little bit f more 
>>> work to be done for that. But if you want it for your next release it is 
>>> pretty much standalone. There is an example provided and plenty of tests.
>>>
>>> Let me know what you guys think, and if you see anything to be 
>>> modified/added.
>>>
>>> Cheers.
>>>
>>> Le mercredi 25 janvier 2017 09:09:48 UTC+1, Andrew Godwin a écrit :

 Yes, it's a bit alarmist if you don't come from the background of 
 writing distributed systems. I just don't like to hide the truth one bit!

 All your software and hardware can fail in myriad ways; I have a talk I 
 need to give about it at some point. Knowing how it fails is half the 
 battle!

 Andrew

 On Wed, Jan 25, 2017 at 12:06 AM, Fabien Millerand  
 wrote:

> Ok, I start to understand now.
> To be frank the docs are a bit alarming :) 
>
>
>
> Le mercredi 25 janvier 2017 08:47:06 UTC+1, Andrew Godwin a écrit :
>>
>>
 I am not sure to understand. In which case can there be 
>>> messages/frames lost?! Where does that happen? Between the server 
>>> interface 
>>> and the Django layer? I would need to know more about that... Otherwise 
>>> I 
>>> might need to move with uWSGI or something JSON-RPC in itself 
>>> doesn't 
>>> implement a timeout, althought the javascript client better have one...
>>>
>>>
>> It simply means that it's possible that you might lose an incoming 
>> frame. This is also true of implementing it in uWSGI (the process 
>> handling 
>> the socket might get OOM killed, or the server might die, etc.)
>>
>> It's not a normal case, it's just that if something super bad 
>> happens, the resulting handling is to drop a message rather than play it 
>> twice. Most systems I know of that handle websockets do this.
>>
>> Andrew 
>>
> -- 
> You received this message because you are subscribed to the Google 
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/97e75375-6caf-4e8d-a781-be6da421840d%40googlegroups.com
>  
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

 -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com .
>>> To post to this group, send email to django...@googlegroups.com 
>>> .
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/49dbc038-46e5-402c-a810-900d47a561bf%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Django users" group.
>> To uns

result of filter query returning empty because of def __unicode__(self)

2017-01-26 Thread Mike08


Does adding a def __unicode__(self): method into a model affect the queries 
being returned ?


I am currently experiencing a situation in which the presence of def 
__unicode__(self): in the model is interfering with the results being 
returned. 


These two are my models

   class modelLabTestName(models.Model):
test_category = models.ForeignKey(modelLabCategory)
test_name = models.CharField(max_length=128, unique=True , 
default="None")
def __unicode__(self):  
return self.test_name   #-->--- Line A  
#return "Test Name : " + self.test_name --->--- Line B
class modelNormalLabTest(models.Model):
test_name = models.ForeignKey(modelLabTestName,default=None)
field_name = models.CharField(max_length=128)
field_value = models.CharField(max_length=128)


Now notice in the above there are two lines A and B. Currently Line B is 
commented and this query works and I get back an object

lab_entries= modelNormalLabTest.objects.filter(test_name__test_name="ABC")


However if I replace

return self.test_name 

in the model modelLabTestName with this instead (Line B)

return "Test Name : " + self.test_name

The query fails (i.e - No object is returned)


My question is why is this happening and if there is any way for me to fix 
this issue. I already checked the value of the test_name property with the 
following statement and it is returning the correct value

t = modelLabTestName.objects.all()[0].test_name #t = "ABC"

then why is

lab_entries= modelNormalLabTest.objects.filter(test_name__test_name="ABC")

or even this

 modelLabTestName.objects.get(test_name="ABC");

returning nothing ? when the model modelLabTestname has the following 
method in it

def __unicode__(self):  
  return "Test Name : " + self.test_name 

Any suggestions would be appreciated. I am using Django (1.10.5)


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bb0e5164-751e-4a85-b71f-72e4c69d49d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django channels on IIS

2017-01-26 Thread Алексей Кузуб
Thank you! Maybe i'll try it. One more question...can i use daphne by https?

четверг, 26 января 2017 г., 14:59:37 UTC+3 пользователь Avraham Serour 
написал:
>
> if you are stuck on windows but not necessarily IIS you may try cygwin, I 
> once had to deploy on windows and after investigating some possibilities I 
> just installed cygwin and put nginx with uwsgi.
>
> On Thu, Jan 26, 2017 at 9:55 AM, Алексей Кузуб  > wrote:
>
>> Thank you for your answers and advices. I have no possibility to use *nix 
>> platform, my employer wants it on IIS. I'll try to build it, thank you very 
>> much!
>>
>> среда, 25 января 2017 г., 21:14:22 UTC+3 пользователь Jani Tiainen 
>> написал:
>>>
>>> There exists 3rd party ASGI handler for IIS: 
>>> https://github.com/mjkillough/iis-asgi-handler/ 
>>>
>>> It also requires at least IIS 8 and websocket protocol installed. More 
>>> details at 
>>> https://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-websocket-protocol-support
>>>
>>> Note, you need to build that handler yourself, which then requires 
>>> another set of tools, visual studio 2015 and CMake 2.8+
>>>
>>> Also note that there is not much of installation instructions or how to 
>>> build package that you can just install to your server without installing 
>>> all the development tools there.
>>>
>>> I really suggest that you try to find some *nix platform to run required 
>>> parts, it's just plain simpler and more documented than IIS.
>>>
>>> On Wed, Jan 25, 2017 at 7:25 PM, Andrew Godwin  
>>> wrote:
>>>
 Hi,

 I am afraid I don't have experience using IIS - I don't know if it even 
 supports HTTP/1.1 proxying, which is needed for WebSockets. Hopefully 
 someone else can help.

 Andrew

 On Wed, Jan 25, 2017 at 6:35 AM, Алексей Кузуб  
 wrote:

> I have a project in Django and i want to use django channels for 
> support websockets in my project, but i have a problem with IIS 
> configuration. Could somebody helps me with configuration daphne in IIS 
> or 
> configuration IIS to support channels and daphne. Has somebody any 
> expierence in it? And maybe somebody knows some ways to deploy 
> django+channels on IIS with or without daphne?
> Sorry for my bad english.
>
> -- 
> You received this message because you are subscribed to the Google 
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/9364bca2-2a03-4ae7-b93b-ff105ff34d31%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

 -- 
 You received this message because you are subscribed to the Google 
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to django-users...@googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/CAFwN1urM2A4HBhPzbG4_Tgs_DKzab39-Pz_jzWa981AGfC0cYg%40mail.gmail.com
  
 
 .

 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>>
>>> -- 
>>> Jani Tiainen
>>>
>>> - Well planned is half done, and a half done has been sufficient 
>>> before...
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/636597f8-5b05-403a-b118-e5e84a841b19%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to 

Re: Django channels on IIS

2017-01-26 Thread Sgiath
Yes you can.
daphne -e ssl:443:privateKey=key.pem:certKey=crt.pem 
django_project.asgi:channel_layer

For more info look at the Daphne GitHub repo https://github.com/django/daphne/

But I would suggest run Nginx in front of the Daphne which will handle SSL.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1026005f-8cb3-4282-a789-a3baa8feac4f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django channels on IIS

2017-01-26 Thread Алексей Кузуб
I have IIS, and i ran IIS in front of Daphne which handle SSL. But when i 
run daphne to listen port which support https in IIS, daphne tell me 
"2017-01-27 10:19:37,082 CRITICAL Unhandled error in Deferred:
2017-01-27 10:19:37,082 CRITICAL
Traceback (most recent call last):
  File "c:\python35\lib\site-packages\twisted\internet\tcp.py", line 981, 
in startListening
skt.bind(addr)
OSError: [WinError 10013] An attempt was made to access a socket in a way 
forbidden by its access pe
rmissions

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\python35\lib\site-packages\twisted\internet\defer.py", line 121, 
in execute
result = callable(*args, **kw)
  File "c:\python35\lib\site-packages\twisted\internet\posixbase.py", line 
478, in listenTCP
p.startListening()
  File "c:\python35\lib\site-packages\twisted\internet\tcp.py", line 983, 
in startListening
raise CannotListenError(self.interface, self.port, le)
twisted.internet.error.CannotListenError: Couldn't listen on 0.0.0.0:1001: 
[WinError 10013] An attem
pt was made to access a socket in a way forbidden by its access 
permissions."
I tried different ports, which allowed in firewall. What i am doing wrong?
пятница, 27 января 2017 г., 10:27:52 UTC+3 пользователь Sgiath написал:
>
> Yes you can.
> daphne -e ssl:443:privateKey=key.pem:certKey=crt.pem 
> django_project.asgi:channel_layer
>
> For more info look at the Daphne GitHub repo 
> https://github.com/django/daphne/
>
> But I would suggest run Nginx in front of the Daphne which will handle SSL.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4d9a0247-c5d0-4733-980f-dd991d871719%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.