Re: E-comm live project

2024-03-18 Thread Andrew Daud Hutahaean
Please add me also, i am interested. my whatsapp: +6282216185302

On Mon, Mar 18, 2024 at 6:34 PM Sang  wrote:

> Looks interesting. I'm on WhatsApp @ 9937826218. Please let's catch up
> there.
>
> On Mon, Mar 18, 2024, 22:56 1001_prabhjot Singh 
> wrote:
>
>> so i am working on a full stack e-comm website and this project is really
>> very big for me because it's a live project am using django for backend
>> interested one's can send there number for WhatsApp group
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/1101d563-726a-458e-ad9f-4b91bebf3132n%40googlegroups.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMg_NadNmJXqGW3vZ%3D7rGDgViQfygtYQUGuRTGRFYexEHKwn0Q%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPzY2wmwq3sYV%3D09pfHW9k4%3DzAgra9WBVtSrqM_Ya3wtCo%2BMDA%40mail.gmail.com.


Re: Exciting Opportunity: Join Our Django WhatsApp Bulk Messaging Project!

2024-02-19 Thread Andrew Tola
I am interested

On Mon, Feb 19, 2024, 9:33 AM Theresa Taye  wrote:

> I am interested
>
> On Sun, Feb 18, 2024, 5:48 PM SURAJ TIWARI  wrote:
>
>>  Join Our Django WhatsApp Bulk Messaging Project!
>>
>>  Hello everyone,
>>
>> Are you looking for an exciting opportunity to gain hands-on experience
>> in Django development? Do you want to work on a meaningful project that
>> leverages WhatsApp for bulk messaging? We're thrilled to invite you to join
>> our dynamic team!
>>
>>  Benefits:
>>
>>- Get hands-on experience working on a real-world Django project.
>>- Learn how to leverage WhatsApp for bulk messaging, a valuable skill
>>in today's digital landscape.
>>- Opportunities for hybrid work, allowing flexibility in your
>>schedule.
>>- Collaborate with experienced developers and gain valuable
>>mentorship.
>>- Access to cutting-edge tools and technologies.
>>
>>  Opportunities Available:
>>
>>- Django developers
>>- Frontend developers
>>- UI/UX designers
>>- Quality assurance testers
>>
>> 欄 How to Join: Simply reply to this message expressing your interest,
>> and we'll provide you with all the necessary details to get started on our
>> project.
>>
>> Let's work together to create something amazing and gain valuable
>> experience along the way! ✨
>>
>> Best regards,
>>
>> Suraj Tiwari
>>
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/e8a705fd-10d9-4c1a-b4ba-0a7b896dbfean%40googlegroups.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAENBRfP0v9_mS%3DqLicTyf5Hu0K7%2BdJyPAyD_qsQzj%2BahrSSGDA%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOAU6PDB5wGsLyNtNWB6Q5uRh8Ns4KOLpy5Da5KZYhBVt3f%2BvQ%40mail.gmail.com.


Looking to help recruiters and job candidates

2023-06-26 Thread Andrew Wang
Hey Djangonaughts! I'm looking to build a tool for recruiters to get 
candidates interviews faster by streamlining recruiters' processes. Would 
greatly appreciate any connects. Also, if you're looking for a software 
engineering role (with at least 1 prior company experience for validation), 
would also love to chat.

acwangpyt...@gmail.com

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cbbacf02-69a0-48db-88c6-44fa2ea8cb8dn%40googlegroups.com.


Re: Seeking Django Unpaid Internship Opportunity in the USA

2023-06-26 Thread Andrew Wang
Happy to chat: and...@lazify.ai

On Wednesday, June 21, 2023 at 4:16:58 PM UTC-4 Karthik wrote:

> Hello 
>
> I hope this email finds you well. My name is Karthik Hosur, and I am 
> writing to express my interest in securing an unpaid internship opportunity 
> in Django development. I have been an avid member of this Django group for 
> some time now and greatly admire the knowledge and expertise shared within 
> this community.
>
>
> I have 1.5 years of work experience as a Django developer and I am 
> currently on my OPT visa in the USA and my unemployment days are running 
> out. To stop my unemployment I can volunteer or work as an unpaid intern. 
>
>
>  I would be delighted to discuss any potential opportunities or answer any 
> questions you may have. I am available to commit 20 hrs a week for this 
> position.
>
>
> Thank You
>
> Karthik Hosur
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5ad92c8d-d598-4134-a1d6-b2ffc1d57ae5n%40googlegroups.com.


Re: Add single object(most recent) from foreign key relationship to django queryset

2023-05-13 Thread Andrew Kos

Could you do a separate query or use select_related() to retrieve the most 
recent comment then combine the two in your table building logic? You're 
going to be constrained by the structure of the models anyways and so will 
probably have to make a couple queries to the DB.
On Friday, May 12, 2023 at 2:03:56 PM UTC-5 Joshua Corlin wrote:

> Hello Django Community, 
>
> Im stuck on something that I feel should be pretty simple.  I have two 
> models Request and RequestComment, naturally RequestComment foreign keys to 
> Request. I have a scenario where i need to base some logic in a view 
> related to Requests off of an attribute in the most recent RequestComment 
> on a Request and im trying to see if I can add the most recent 
> RequestComment for reach Request to a request queryset so that i can use 
> this in a table.  
>
> sample request queryset: 
> q1 = Request.objects.filter("status="New", created_at__lt="timezone.now() 
> - timdelta(days=1))
>
> I would like to add the most recent comment object to each result this 
> query, effectively adding the result of querying RequestComment for the 
> related Request in each row of q1 and filtering by -created_at and calling 
> .first() and adding that as like request_latest_comment or similar. Im 
> looking to add the whole object, as RequestComment also foreign keys to 
> user which i need some info there too.  
>
> Is this something that can be done with annotate?  If someone is able to 
> provide either a suggestion or a link to a kb/forum where similar has been 
> done, id greatly appreciate it. 
>
> Best, 
> Josh
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d24b9671-354a-4ae3-a187-670f76731c59n%40googlegroups.com.


Re: Django Admin

2023-03-13 Thread Andrew Romany
It's very simple you should add it in the login/register html page but
inside the  tag after &  to be specific after this
above line.

On Mon, 13 Mar 2023, 11:15 a.m. James Hunt,  wrote:

> I have yet to create a HTML page so I'm not sure that the inclusion of {%
> csrf_token %} is required. I mean it's just the admin page I am trying to
> access which is provided by Django and not a page created by me!!!
>
> I am very surprised there is no fix for this issue!!! I might need to
> abandon Django and move a different framework given that this issue is at
> the start of a project!!!
>
> Cheers
>
> Jay
>
> On Monday, March 13, 2023 at 3:06:42 AM UTC Mir Junaid wrote:
>
>> try including this line in your index.html or main HTML page
>> {% csrf_token %}
>> if it still doesn't work do include it in every html page
>>
>> On Sat, 11 Mar 2023 at 23:33, James Hunt  wrote:
>>
>>> Hi there. I am fairly new to Django but have had previous success with
>>> creating an app and being able to access the Admin page.
>>> Recently, if I attempt to access the admin page of a new Django app it
>>> throws the CSRF error upon trying to log in!!!
>>>
>>> I have attempted several ways to bypass this error including adding
>>> allowed hosts but I cant seem to get past this issue.
>>>
>>> Can someone please provide me with the definitive way of stopping CSRF
>>> error when simply trying to access the admin part of Django? I mean there
>>> are no post functions that really apply to this feature so I cant
>>> understand the CSRF token.
>>>
>>> I cant get past this issue which means I can never access the admin
>>> page!!
>>>
>>> Please help.
>>>
>>> Regards
>>>
>>> James
>>>
>>> --
>>>
>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/e13c7765-831e-45c5-b091-c8fcfbed19c5n%40googlegroups.com
>>> 
>>> .
>>>
>> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6f8d686c-3075-4aff-8227-c2f86e3cn%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGEtskruq9C4tg0BXDObB%2B7RORbKs8WXJcPOtTCO5Yw48fa1xA%40mail.gmail.com.


how to initialize input form fields using URL parameters

2023-01-22 Thread Andrew Brown

I am trying to pass initial values to my form set via URL Query
ex) Localhost:8000?/First_name_id_0=Samuel
[image: forms.py.png]

I was told to use the initial parameter and not the instance in my view 
first

"An inline formset is related to one instance of the parent model. You 
identify *which* instance the formset is related to by the “instance” 
parameter. The “initial” parameter has a different usage, which is defined 
in the docs."

But I can't seem to find an examples in the docs
[image: Views.py.png]

How do I change my view so that that it initialize my form set with URL 
Query?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/34ccbb87-11dc-4097-84ac-95f229d9183an%40googlegroups.com.


Re: missing field after makemigrations

2022-06-20 Thread andrew snyder
Thanks, that did the trick.  Should I make a feature request that django 
throw an error whenever a field type has no real type?

>>> type(models.SmallIntegerField())

>>> type(models.SmallIntegerField)


On Monday, June 20, 2022 at 10:53:37 AM UTC-4 moheb@gmail.com wrote:

> Hi,
> The reason why "rank" is missing is because you didn't use round brackets 
> "(" ")". It should be "models.SmallIntegerField()" not 
> "models.SmallIntegerField".
>
> On Monday, June 20, 2022 at 7:12:58 PM UTC+5 a...@dancingjars.com wrote:
>
>> There is something in my models.py that breaks makemigrations.
>>
>> The field "rank" is missing from "CharacterSkill".  Also, if I uncomment 
>> any of the three classes that refer to "Character" the "game" and "player" 
>> fields become separate items in the migrations file.
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/95d842e9-534a-407a-b1c6-a632602c46aan%40googlegroups.com.


Re: i am facing problem with my project to update data in mysql using django

2022-06-20 Thread andrew snyder
can you conform that database user has permissions to update data in all 
three databases using a mysql client?


On Thursday, June 16, 2022 at 12:02:00 PM UTC-4 rafiurra...@gmail.com wrote:

> here is my problem description link in stackoverflow
> if anyone can help me, i will be gratefull
>
> linkproblem link 
> 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9b12fe2f-fcef-4103-94d9-fd18cd8b93c8n%40googlegroups.com.


missing field after makemigrations

2022-06-20 Thread andrew snyder
There is something in my models.py that breaks makemigrations.

The field "rank" is missing from "CharacterSkill".  Also, if I uncomment 
any of the three classes that refer to "Character" the "game" and "player" 
fields become separate items in the migrations file.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0de00b05-f1ba-4be8-92eb-1110cd6ba458n%40googlegroups.com.
from django.db import models
from django.urls import reverse
from django.contrib.auth.models import User

# Create your models here.
class Skill(models.Model):
name = models.CharField(max_length=200)
description = models.CharField(max_length=2000)
overcome = models.BooleanField(default=True)
advantage = models.BooleanField(default=True)
attack = models.BooleanField(default=False)
defend = models.BooleanField(default=False)

class Meta:
ordering = ['name']

def __str__(self):
return self.name

class Setting(models.Model):
name = models.CharField(max_length=200)
description = models.CharField(max_length=2000)

class Meta:
ordering = ['name']

def __str__(self):
return self.name

class SettingSkill(models.Model):
setting = models.ForeignKey(Setting, on_delete=models.CASCADE)
skill  = models.ManyToManyField(Skill)

def __str__(self):
associated = ", ".join(str(seg) for seg in self.skill.all())
return "{}: {}".format(self.setting, associated)

class Game(models.Model):
gm = models.ForeignKey(User, on_delete=models.CASCADE)
players  = models.ManyToManyField(User, related_name='player')
setting = models.ForeignKey(Setting, on_delete=models.CASCADE)
name = models.CharField(max_length=200)

def get_absolute_url(self):
return reverse('game-detail', kwargs={'pk': self.pk})

def __str__(self):
return "{}; a {} game".format(self.name, self.setting)


class Character(models.Model):
game = models.ForeignKey(Game, models.SET_NULL, blank=True, null=True)
player = models.ForeignKey(User, models.SET_NULL, blank=True, null=True)
name = models.CharField(max_length=200)
concept = models.CharField(max_length=200)

def get_absolute_url(self):
return reverse('character-detail', kwargs={'pk': self.pk})

def __str__(self):
return self.name

# class CharacterAspect(models.Model):
# description = models.CharField(max_length=2000)
# character = models.ForeignKey(Character, on_delete=models.CASCADE)

class CharacterSkill(models.Model):
character = models.ForeignKey(Character, on_delete=models.CASCADE)
skill = models.ForeignKey(Skill, on_delete=models.RESTRICT)
rank = models.SmallIntegerField

def __str__(self):
return self.skill.name

#class CharacterStunt(models.Model):
#character = models.ForeignKey(Character, on_delete=models.CASCADE)
#name = models.CharField(max_length=200)
#description = models.CharField(max_length=2000)
#skill  = models.ForeignKey(Skill, blank=True, null=True, on_delete=models.RESTRICT)
#
#class Meta:
#ordering = ['name']
#
#def __str__(self):
#return self.name
# Generated by Django 4.0.4 on 2022-06-20 10:37

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name='Character',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200)),
('concept', models.CharField(max_length=200)),
],
),
migrations.CreateModel(
name='Setting',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200)),
('description', models.CharField(max_length=2000)),
],
options={
'ordering': ['name'],
},
),
migrations.CreateModel(
name='Skill',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200)),
('description', models.CharField(max_length=2000)),
('overcome', models.BooleanField(default=True)),
('advantage', models.BooleanField(default=True)),
('attack', 

OperationalError at /admin/login database or disk is full

2022-05-27 Thread Andrew Rea
Hello!

This is my first post in this group so be gentle. 

I'm creating a new Django project, and I've successfully created a 
superuser. But when I try to access the Admin page of my project with my 
superuser credentials, I receive this error:

OperationalError at /admin/login/ 
database or disk is full

Is this because my SQLite database is full from other projects? Or possibly 
because I have too many virtual envs from those same other projects? *Or* is 
it due to my personal computer's disk being too full?

Thank you in advance,

Andrew S. Rea

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d96ae214-4c6f-43c7-ae94-7fba910e68a1n%40googlegroups.com.


Re: Async Help Needed

2021-08-12 Thread Andrew Godwin
The example you presented should Just Work - that error generally only occurs 
if you return an un-awaited coroutine, which if you're just returning a 
response, should be impossible.

What version of Python and Django are you running?

Andrew

On Thu, Aug 12, 2021, at 11:03 AM, Steven Mapes wrote:
> Does anyone have some links to good guides on getting asnyc to work with 
> Django? I have a use case where I really need to have a view give an async 
> response but I can't get even the most basic of examples working.
> 
> I've tried the examples from https://testdriven.io/blog/django-async-views/ 
> with a simple view of:
> 
> async def test_view(request):
> return HttpResponse("Hello, async Django!")
> 
> I've installed uvicorn and am running it with  uvicorn 
> my_project.asgi:application --reload
> 
> My sync views work as expected but the async one just returns an error of 
> "*The view sample.views.test_view didn't return an HttpResponse object. It 
> returned an unawaited coroutine instead. You may need to add an 'await' into 
> your view.*"
> 
> 
> 
> 
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/64f90a01-76fe-4e01-ab3a-a6a0910038c9n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/64f90a01-76fe-4e01-ab3a-a6a0910038c9n%40googlegroups.com?utm_medium=email_source=footer>.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/378098bf-4754-4d4e-afc0-82eb04873438%40www.fastmail.com.


Re: register_converter doesn't work with ASGI

2021-06-20 Thread Andrew Godwin
Ah yes, that's because the URL parsing/conversion all happens in the main 
(async, in ASGI mode) thread - and because to_python is a a synchronous 
function interface, there is literally nothing you can do to make it work.

The only real way of fixing this would be for Django to patch the URL 
converters and run them all in a synchronous mode unless they were decorated as 
"safe" somehow, much like we do for middleware. It's not a terribly hard patch 
to make, but it does mean you don't have an immediate solution. There are ways 
of trying to work around it, but they will all result in you blocking the async 
thread while the ORM query runs, which would be disastrous in production.

My apologies for not getting this in for the original async view patch - I had 
forgotten converters ran in the URL resolver.

Andrew

On Sat, Jun 19, 2021, at 12:31 AM, konstanti...@gmail.com 
<mailto:konstanti...%40gmail.com> wrote:
> 
> I'm trying to switch from WSGI to ASGI and I'm having issues with my model id 
> to model converters.
> I define my converters like this
> def to_python(self, primary_key):
>  try:
>   return self.model.objects.get(pk=primary_key)
>  except self.model.DoesNotExist:
>   raise ValueError
> When I go to a url where a converter is used I get a SynchronousOnlyOperation.
> Seems like converters are executed in an async context.
> If I use sync_to_async, I get a coroutine in my view instead of a model 
> instance. Awaiting it here would defeat the purpose of having a converter.
> 
> Any ideas how to fix this?
> 

> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/ef60ed71-7f4f-482d-b540-bdf89e249aa4n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/ef60ed71-7f4f-482d-b540-bdf89e249aa4n%40googlegroups.com?utm_medium=email_source=footer>.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/34c22d74-ba14-45b0-81fa-85f03c5f34af%40www.fastmail.com.


Re: Daphne raises Internal Server Error when accessing static files from development server

2021-04-06 Thread Andrew Godwin
This is probably this error: 
https://github.com/django/asgiref/issues/251#issuecomment-814337170 - I'm going 
to switch the error to a warning and we'll see if that helps, then Daphne can 
have a fix added at a non-emergency pace.

Andrew

On Tue, Apr 6, 2021, at 12:19 PM, kradem wrote:
> Not sure if I understand you, I'm getting an server error in my browser with 
> rendered as quoted in the first post here with the following body:
> 
>500 Internal Server Error   body { 
> font-family: sans-serif; margin: 0; padding: 0; }  h1 { padding: 0.6em 0 
> 0.2em 20px; color: #896868; margin: 0; }  p { padding: 0 0 0.3em 20px; 
> margin: 0; }  footer { padding: 1em 0 0.3em 20px; color: #999; font-size: 
> 80%; font-style: italic; }500 Internal Server 
> Error Exception inside application. Daphne 
>   
> And as raw:
> 
> HTTP/1.1 500 Internal Server Error
> Transfer-Encoding: chunked
> Content-Type: text/html; charset=utf-8
> 
> Dana utorak, 6. travnja 2021. u 18:26:34 UTC+2 korisnik Andrew Godwin napisao 
> je:
>> __
>> The tracebacks are there somewhere, you might have to look at the raw HTTP 
>> response in the browser to see them.
>> 
>> Andrew
>> 
>> On Tue, Apr 6, 2021, at 10:18 AM, kradem wrote:
>>> I'm afraid a "success" was caused by the browser cache or something 
>>> similar, the 3.3.3 version doesn't fix my problem. :(
>>> 
>>> > Could you get the traceback out of Django that's causing the 500 error 
>>> > and post it here? 
>>> 
>>> That was - kind of - my initial question, the only output I can get is the 
>>> message from the first post and Django's output like:
>>> 
>>> HTTP GET /static/css/style.css 500 [0.35, 127.0.0.1:37982]
>>> HTTP GET /static/js/jquery-2.2.4.min.js 500 [0.35, 127.0.0.1:37988]
>>> 
>>> Dana utorak, 6. travnja 2021. u 18:09:33 UTC+2 korisnik Andrew Godwin 
>>> napisao je:
>>>> __
>>>> Aha, glad to hear it! My apologies that we didn't catch that one before 
>>>> release yesterday.
>>>> 
>>>> Andrew
>>>> 
>>>> On Tue, Apr 6, 2021, at 10:01 AM, kradem wrote:
>>>>> Stop the press!! The 3.3.3 version is published in PyPi and after 
>>>>> installing it it all works well! :)
>>>>> 
>>>>> Thank you!
>>>>> Dana utorak, 6. travnja 2021. u 17:56:44 UTC+2 korisnik kradem napisao je:
>>>>>> Thank you very much for a quick response.
>>>>>> 
>>>>>> Yes, that's the problem:
>>>>>> 
>>>>>> asgiref   3.3.2
>>>>>> 
>>>>>> When I downgrade it to 3.3.1 Django complains ("django 3.2 requires 
>>>>>> asgiref<4,>=3.3.2, but you have asgiref 3.3.1 which is incompatible."), 
>>>>>> but static files are served well.
>>>>>> 
>>>>>> I tried with the very last version 3.3.3 (-e 
>>>>>> git+https://github.com/django/asgiref.git#egg=asgiref), but problem 
>>>>>> hasn't been fixed that way.
>>>>>> 
>>>>>> 
>>>>>> Dana utorak, 6. travnja 2021. u 17:46:31 UTC+2 korisnik Andrew Godwin 
>>>>>> napisao je:
>>>>>>> __
>>>>>>> This may be related to https://github.com/django/asgiref/issues/251 - 
>>>>>>> what version of asgiref are you running?
>>>>>>> 
>>>>>>> Andrew
>>>>>>> 
>>>>>>> On Tue, Apr 6, 2021, at 9:43 AM, kradem wrote:
>>>>>>>> > 500 Internal Server Error 
>>>>>>>> > Exception inside application.

>>>>>>>> > Daphne
>>>>>>>> 
>>>>>>>> This error raises every time a file from static folder is accessed.
>>>>>>>> 
>>>>>>>> What would be a proper way for debugging this? I've got  "justMyCode": 
>>>>>>>> false setting in VS Code and that doesn't catch anything.
>>>>>>>> 
>>>>>>>> Python 3.9.2
>>>>>>>> 
>>>>>>>> channels  3.0.3
>>>>>>>> daphne3.0.1
>>>>>>>> Django3.2
>>>>>>>> 
>>>>>>>> 

>>>>>>>> -- 
>>>>>>>> You received thi

Re: Daphne raises Internal Server Error when accessing static files from development server

2021-04-06 Thread Andrew Godwin
The tracebacks are there somewhere, you might have to look at the raw HTTP 
response in the browser to see them.

Andrew

On Tue, Apr 6, 2021, at 10:18 AM, kradem wrote:
> I'm afraid a "success" was caused by the browser cache or something similar, 
> the 3.3.3 version doesn't fix my problem. :(
> 
> > Could you get the traceback out of Django that's causing the 500 error and 
> > post it here? 
> 
> That was - kind of - my initial question, the only output I can get is the 
> message from the first post and Django's output like:
> 
> HTTP GET /static/css/style.css 500 [0.35, 127.0.0.1:37982]
> HTTP GET /static/js/jquery-2.2.4.min.js 500 [0.35, 127.0.0.1:37988]
> 
> Dana utorak, 6. travnja 2021. u 18:09:33 UTC+2 korisnik Andrew Godwin napisao 
> je:
>> __
>> Aha, glad to hear it! My apologies that we didn't catch that one before 
>> release yesterday.
>> 
>> Andrew
>> 
>> On Tue, Apr 6, 2021, at 10:01 AM, kradem wrote:
>>> Stop the press!! The 3.3.3 version is published in PyPi and after 
>>> installing it it all works well! :)
>>> 
>>> Thank you!
>>> Dana utorak, 6. travnja 2021. u 17:56:44 UTC+2 korisnik kradem napisao je:
>>>> Thank you very much for a quick response.
>>>> 
>>>> Yes, that's the problem:
>>>> 
>>>> asgiref   3.3.2
>>>> 
>>>> When I downgrade it to 3.3.1 Django complains ("django 3.2 requires 
>>>> asgiref<4,>=3.3.2, but you have asgiref 3.3.1 which is incompatible."), 
>>>> but static files are served well.
>>>> 
>>>> I tried with the very last version 3.3.3 (-e 
>>>> git+https://github.com/django/asgiref.git#egg=asgiref), but problem hasn't 
>>>> been fixed that way.
>>>> 
>>>> 
>>>> Dana utorak, 6. travnja 2021. u 17:46:31 UTC+2 korisnik Andrew Godwin 
>>>> napisao je:
>>>>> __
>>>>> This may be related to https://github.com/django/asgiref/issues/251 - 
>>>>> what version of asgiref are you running?
>>>>> 
>>>>> Andrew
>>>>> 
>>>>> On Tue, Apr 6, 2021, at 9:43 AM, kradem wrote:
>>>>>> > 500 Internal Server Error 
>>>>>> > Exception inside application.

>>>>>> > Daphne
>>>>>> 
>>>>>> This error raises every time a file from static folder is accessed.
>>>>>> 
>>>>>> What would be a proper way for debugging this? I've got  "justMyCode": 
>>>>>> false setting in VS Code and that doesn't catch anything.
>>>>>> 
>>>>>> Python 3.9.2
>>>>>> 
>>>>>> channels  3.0.3
>>>>>> daphne3.0.1
>>>>>> Django3.2
>>>>>> 
>>>>>> 

>>>>>> -- 
>>>>>> 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 view this discussion on the web visit 
>>>>>> https://groups.google.com/d/msgid/django-users/9db2fc19-e87c-4a69-ab9e-6c53ec56d6fcn%40googlegroups.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/django-users/9db2fc19-e87c-4a69-ab9e-6c53ec56d6fcn%40googlegroups.com?utm_medium=email_source=footer>.
>>>>> 
>>> 

>>> -- 
>>> 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 view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/bd27e80e-de40-4dfd-b215-7855f537b191n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/django-users/bd27e80e-de40-4dfd-b215-7855f537b191n%40googlegroups.com?utm_medium=email_source=footer>.
> 

> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/7a5a269b-9099-4bbf-af72-65b6c77bb511n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/7a5a269b-9099-4bbf-af72-65b6c77bb511n%40googlegroups.com?utm_medium=email_source=footer>.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/789cfaea-899b-4f23-885b-4e2857e7dbd1%40www.fastmail.com.


Re: Daphne raises Internal Server Error when accessing static files from development server

2021-04-06 Thread Andrew Godwin
Aha, glad to hear it! My apologies that we didn't catch that one before release 
yesterday.

Andrew

On Tue, Apr 6, 2021, at 10:01 AM, kradem wrote:
> Stop the press!! The 3.3.3 version is published in PyPi and after installing 
> it it all works well! :)
> 
> Thank you!
> Dana utorak, 6. travnja 2021. u 17:56:44 UTC+2 korisnik kradem napisao je:
>> Thank you very much for a quick response.
>> 
>> Yes, that's the problem:
>> 
>> asgiref   3.3.2
>> 
>> When I downgrade it to 3.3.1 Django complains ("django 3.2 requires 
>> asgiref<4,>=3.3.2, but you have asgiref 3.3.1 which is incompatible."), but 
>> static files are served well.
>> 
>> I tried with the very last version 3.3.3 (-e 
>> git+https://github.com/django/asgiref.git#egg=asgiref), but problem hasn't 
>> been fixed that way.
>> 
>> 
>> Dana utorak, 6. travnja 2021. u 17:46:31 UTC+2 korisnik Andrew Godwin 
>> napisao je:
>>> __
>>> This may be related to https://github.com/django/asgiref/issues/251 - what 
>>> version of asgiref are you running?
>>> 
>>> Andrew
>>> 
>>> On Tue, Apr 6, 2021, at 9:43 AM, kradem wrote:
>>>> > 500 Internal Server Error 
>>>> > Exception inside application.

>>>> > Daphne
>>>> 
>>>> This error raises every time a file from static folder is accessed.
>>>> 
>>>> What would be a proper way for debugging this? I've got  "justMyCode": 
>>>> false setting in VS Code and that doesn't catch anything.
>>>> 
>>>> Python 3.9.2
>>>> 
>>>> channels  3.0.3
>>>> daphne3.0.1
>>>> Django3.2
>>>> 
>>>> 

>>>> -- 
>>>> 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 view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/django-users/9db2fc19-e87c-4a69-ab9e-6c53ec56d6fcn%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/django-users/9db2fc19-e87c-4a69-ab9e-6c53ec56d6fcn%40googlegroups.com?utm_medium=email_source=footer>.
>>> 
> 

> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/bd27e80e-de40-4dfd-b215-7855f537b191n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/bd27e80e-de40-4dfd-b215-7855f537b191n%40googlegroups.com?utm_medium=email_source=footer>.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8c9616ad-021a-4162-8f52-b0be27f46d94%40www.fastmail.com.


Re: Daphne raises Internal Server Error when accessing static files from development server

2021-04-06 Thread Andrew Godwin
asgiref 3.3.2 introduced stricter checks for what an async function is, so I 
would imagine that's the problem. 3.3.3 fixes some of them, but I'm guessing 
you might have a different flavour of problem.

Could you get the traceback out of Django that's causing the 500 error and post 
it here? 

Andrew

On Tue, Apr 6, 2021, at 9:56 AM, kradem wrote:
> Thank you very much for a quick response.
> 
> Yes, that's the problem:
> 
> asgiref   3.3.2
> 
> When I downgrade it to 3.3.1 Django complains ("django 3.2 requires 
> asgiref<4,>=3.3.2, but you have asgiref 3.3.1 which is incompatible."), but 
> static files are served well.
> 
> I tried with the very last version 3.3.3 (-e 
> git+https://github.com/django/asgiref.git#egg=asgiref), but problem hasn't 
> been fixed that way.
> 
> 
> Dana utorak, 6. travnja 2021. u 17:46:31 UTC+2 korisnik Andrew Godwin napisao 
> je:
>> __
>> This may be related to https://github.com/django/asgiref/issues/251 - what 
>> version of asgiref are you running?
>> 
>> Andrew
>> 
>> On Tue, Apr 6, 2021, at 9:43 AM, kradem wrote:
>>> > 500 Internal Server Error 
>>> > Exception inside application.

>>> > Daphne
>>> 
>>> This error raises every time a file from static folder is accessed.
>>> 
>>> What would be a proper way for debugging this? I've got  "justMyCode": 
>>> false setting in VS Code and that doesn't catch anything.
>>> 
>>> Python 3.9.2
>>> 
>>> channels  3.0.3
>>> daphne3.0.1
>>> Django3.2
>>> 
>>> 

>>> -- 
>>> 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 view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/9db2fc19-e87c-4a69-ab9e-6c53ec56d6fcn%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/django-users/9db2fc19-e87c-4a69-ab9e-6c53ec56d6fcn%40googlegroups.com?utm_medium=email_source=footer>.
>> 
> 

> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/5c9ffb1b-c644-41c6-a5c3-a52bb95a1893n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/5c9ffb1b-c644-41c6-a5c3-a52bb95a1893n%40googlegroups.com?utm_medium=email_source=footer>.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/04bc66bc-1cfc-4c02-8333-45b12af186e8%40www.fastmail.com.


Re: Daphne raises Internal Server Error when accessing static files from development server

2021-04-06 Thread Andrew Godwin
This may be related to https://github.com/django/asgiref/issues/251 - what 
version of asgiref are you running?

Andrew

On Tue, Apr 6, 2021, at 9:43 AM, kradem wrote:
> > 500 Internal Server Error 
> > Exception inside application.

> > Daphne
> 
> This error raises every time a file from static folder is accessed.
> 
> What would be a proper way for debugging this? I've got  "justMyCode": false 
> setting in VS Code and that doesn't catch anything.
> 
> Python 3.9.2
> 
> channels  3.0.3
> daphne3.0.1
> Django3.2
> 
> 

> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/9db2fc19-e87c-4a69-ab9e-6c53ec56d6fcn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/9db2fc19-e87c-4a69-ab9e-6c53ec56d6fcn%40googlegroups.com?utm_medium=email_source=footer>.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5db33183-8f45-43b9-9485-9e909bea5058%40www.fastmail.com.


Re: Patreon and Django-AllAuth Integration

2020-10-30 Thread Andrew Stringfield
You guys are awesome!  I will try these solutions later this evening.

On Wednesday, October 28, 2020 at 11:30:56 PM UTC-4 oladipo...@gmail.com 
wrote:

> Hello Sir,
> You need to set the LOGIN_REDIRECT_URL in your settings.py file.
>
> On Mon, Oct 26, 2020, 8:47 PM Andrew Stringfield  
> wrote:
>
>> Hello all,
>>
>> I am trying to use Patreon's API Version 2 with Django 3.1.  I read: 
>> https://docs.patreon.com/#third-party-libraries and found that Patreon 
>> supported the django-allauth library.  I installed the library by following 
>> the instructions of: 
>> https://django-allauth.readthedocs.io/en/latest/installation.html.  I 
>> start up the default dev server and I go to 
>> http://127.0.0.1:8000/accounts/signup/ and fill out the form and hit 
>> submit.  I get the response of:
>> -
>> Page not found (404)Request Method:
>> GETRequest URL:
>> http://127.0.0.1:8000/accounts/profile/
>>
>> Using the URLconf defined in mysite.urls, Django tried these URL 
>> patterns, in this order:
>>
>>1. admin/
>>2. accounts/ signup/ [name='account_signup']
>>3. accounts/ login/ [name='account_login']
>>4. accounts/ logout/ [name='account_logout']
>>5. accounts/ password/change/ [name='account_change_password']
>>6. accounts/ password/set/ [name='account_set_password']
>>7. accounts/ inactive/ [name='account_inactive']
>>8. accounts/ email/ [name='account_email']
>>9. accounts/ confirm-email/ [name='account_email_verification_sent']
>>10. accounts/ ^confirm-email/(?P[-:\w]+)/$ 
>>[name='account_confirm_email']
>>11. accounts/ password/reset/ [name='account_reset_password']
>>12. accounts/ password/reset/done/ 
>>[name='account_reset_password_done']
>>13. accounts/ 
>>^password/reset/key/(?P[0-9A-Za-z]+)-(?P.+)/$ 
>>[name='account_reset_password_from_key']
>>14. accounts/ password/reset/key/done/ 
>>[name='account_reset_password_from_key_done']
>>15. accounts/ social/
>>16. accounts/ patreon/
>>
>> The current path, accounts/profile/, didn't match any of these.
>>
>> You're seeing this error because you have DEBUG = True in your Django 
>> settings file. Change that to False, and Django will display a standard 404 
>> page.
>>
>> -
>>
>> I want to get data from Patreon, but it looks like I am just creating 
>> local user accounts in the database.  What am I doing wrong?
>>
>> -- 
>>
> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/090d5b8f-d8cf-4ba7-86b1-35017dec2397n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/090d5b8f-d8cf-4ba7-86b1-35017dec2397n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d2db7ef8-36a7-4f98-9c53-cdc7f2a0f4e7n%40googlegroups.com.


Re: Patreon and Django-AllAuth Integration

2020-10-28 Thread Andrew Stringfield
I would not be shocked.

On Wednesday, October 28, 2020 at 9:55:15 AM UTC-4 Ryan Nowakowski wrote:

> The patreon error you're seeing might be a different redirect URL than the 
> login redirect URL. i.e. these may be two different problems.
>
>
>
>
> On October 28, 2020 6:55:48 AM CDT, Andrew Stringfield <
> thefund...@gmail.com> wrote:
>>
>> I almost forgot.  I have checked my settings in Django and Patreon and 
>> the URL redirect matches for all that I can see.  I have an idea to try and 
>> use the testing framework to see what values I am passing to Patreon.
>>
>> On Wednesday, October 28, 2020 at 7:53:42 AM UTC-4 Andrew Stringfield 
>> wrote:
>>
>>> Sorry for the late reply.  I found a youtube video of: 
>>> https://www.youtube.com/watch?v=-TUEM2NCuVE and I followed the 
>>> instructions as best as I could.  I created a button for a Patreon login 
>>> and I get the below results:
>>>
>>> In my URL bar I get: 
>>> https://www.patreon.com/oauth2/errors?error=invalid_request_description=Mismatching+redirect+URI.=z5ycBAl8AI5V
>>> and in my HTML Body I get: 
>>> {"error":"invalid_request","error_description":"Mismatching redirect 
>>> URI.","state":"z5ycBAl8AI5V"}
>>>
>>>
>>> On Tuesday, October 27, 2020 at 9:28:38 AM UTC-4 Ryan Nowakowski wrote:
>>>
>>>> On Mon, Oct 26, 2020 at 12:16:03PM -0700, Andrew Stringfield wrote: 
>>>> > Hello all, 
>>>> > 
>>>> > I am trying to use Patreon's API Version 2 with Django 3.1. I 
>>>> > read: https://docs.patreon.com/#third-party-libraries and found that 
>>>> > Patreon supported the django-allauth library. I installed the library 
>>>> by 
>>>> > following the instructions 
>>>> > of: https://django-allauth.readthedocs.io/en/latest/installation.html. 
>>>> I 
>>>> > start up the default dev server and I go 
>>>> > to http://127.0.0.1:8000/accounts/signup/ and fill out the form and 
>>>> hit 
>>>> > submit. I get the response of: 
>>>> > - 
>>>> > Page not found (404)Request Method: 
>>>> > GETRequest URL: 
>>>> > http://127.0.0.1:8000/accounts/profile/ 
>>>> > 
>>>> > Using the URLconf defined in mysite.urls, Django tried these URL 
>>>> patterns, 
>>>> > in this order: 
>>>> > 
>>>> > 1. admin/ 
>>>> > 2. accounts/ signup/ [name='account_signup'] 
>>>> > 3. accounts/ login/ [name='account_login'] 
>>>> > 4. accounts/ logout/ [name='account_logout'] 
>>>> > 5. accounts/ password/change/ [name='account_change_password'] 
>>>> > 6. accounts/ password/set/ [name='account_set_password'] 
>>>> > 7. accounts/ inactive/ [name='account_inactive'] 
>>>> > 8. accounts/ email/ [name='account_email'] 
>>>> > 9. accounts/ confirm-email/ [name='account_email_verification_sent'] 
>>>> > 10. accounts/ ^confirm-email/(?P[-:\w]+)/$ 
>>>> > [name='account_confirm_email'] 
>>>> > 11. accounts/ password/reset/ [name='account_reset_password'] 
>>>> > 12. accounts/ password/reset/done/ 
>>>> [name='account_reset_password_done'] 
>>>> > 13. accounts/ 
>>>> ^password/reset/key/(?P[0-9A-Za-z]+)-(?P.+)/$ 
>>>> > [name='account_reset_password_from_key'] 
>>>> > 14. accounts/ password/reset/key/done/ 
>>>> > [name='account_reset_password_from_key_done'] 
>>>> > 15. accounts/ social/ 
>>>> > 16. accounts/ patreon/ 
>>>> > 
>>>> > The current path, accounts/profile/, didn't match any of these. 
>>>>
>>>> That's the default LOGIN_REDIRECT_URL[1]. Explicitly set that in your 
>>>> settings.py to wherever you want the user to land after login succeeds. 
>>>>
>>>> [1] 
>>>> https://docs.djangoproject.com/en/3.1/ref/settings/#login-redirect-url 
>>>>
>>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/914b5ef0-c1f0-408b-b1c3-0b1977ddd43an%40googlegroups.com.


Re: Patreon and Django-AllAuth Integration

2020-10-28 Thread Andrew Stringfield
I almost forgot.  I have checked my settings in Django and Patreon and the 
URL redirect matches for all that I can see.  I have an idea to try and use 
the testing framework to see what values I am passing to Patreon.

On Wednesday, October 28, 2020 at 7:53:42 AM UTC-4 Andrew Stringfield wrote:

> Sorry for the late reply.  I found a youtube video of: 
> https://www.youtube.com/watch?v=-TUEM2NCuVE and I followed the 
> instructions as best as I could.  I created a button for a Patreon login 
> and I get the below results:
>
> In my URL bar I get: 
> https://www.patreon.com/oauth2/errors?error=invalid_request_description=Mismatching+redirect+URI.=z5ycBAl8AI5V
> and in my HTML Body I get: 
> {"error":"invalid_request","error_description":"Mismatching redirect 
> URI.","state":"z5ycBAl8AI5V"}
>
>
> On Tuesday, October 27, 2020 at 9:28:38 AM UTC-4 Ryan Nowakowski wrote:
>
>> On Mon, Oct 26, 2020 at 12:16:03PM -0700, Andrew Stringfield wrote:
>> > Hello all,
>> > 
>> > I am trying to use Patreon's API Version 2 with Django 3.1. I 
>> > read: https://docs.patreon.com/#third-party-libraries and found that 
>> > Patreon supported the django-allauth library. I installed the library 
>> by 
>> > following the instructions 
>> > of: https://django-allauth.readthedocs.io/en/latest/installation.html. 
>> I 
>> > start up the default dev server and I go 
>> > to http://127.0.0.1:8000/accounts/signup/ and fill out the form and 
>> hit 
>> > submit. I get the response of:
>> > -
>> > Page not found (404)Request Method:
>> > GETRequest URL:
>> > http://127.0.0.1:8000/accounts/profile/
>> > 
>> > Using the URLconf defined in mysite.urls, Django tried these URL 
>> patterns, 
>> > in this order:
>> > 
>> > 1. admin/
>> > 2. accounts/ signup/ [name='account_signup']
>> > 3. accounts/ login/ [name='account_login']
>> > 4. accounts/ logout/ [name='account_logout']
>> > 5. accounts/ password/change/ [name='account_change_password']
>> > 6. accounts/ password/set/ [name='account_set_password']
>> > 7. accounts/ inactive/ [name='account_inactive']
>> > 8. accounts/ email/ [name='account_email']
>> > 9. accounts/ confirm-email/ [name='account_email_verification_sent']
>> > 10. accounts/ ^confirm-email/(?P[-:\w]+)/$ 
>> > [name='account_confirm_email']
>> > 11. accounts/ password/reset/ [name='account_reset_password']
>> > 12. accounts/ password/reset/done/ [name='account_reset_password_done']
>> > 13. accounts/ 
>> ^password/reset/key/(?P[0-9A-Za-z]+)-(?P.+)/$ 
>> > [name='account_reset_password_from_key']
>> > 14. accounts/ password/reset/key/done/ 
>> > [name='account_reset_password_from_key_done']
>> > 15. accounts/ social/
>> > 16. accounts/ patreon/
>> > 
>> > The current path, accounts/profile/, didn't match any of these.
>>
>> That's the default LOGIN_REDIRECT_URL[1]. Explicitly set that in your
>> settings.py to wherever you want the user to land after login succeeds.
>>
>> [1] 
>> https://docs.djangoproject.com/en/3.1/ref/settings/#login-redirect-url
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6164113b-c063-4607-a194-4a19ed214b15n%40googlegroups.com.


Re: Patreon and Django-AllAuth Integration

2020-10-28 Thread Andrew Stringfield
Sorry for the late reply.  I found a youtube video 
of: https://www.youtube.com/watch?v=-TUEM2NCuVE and I followed the 
instructions as best as I could.  I created a button for a Patreon login 
and I get the below results:

In my URL bar I get: 
https://www.patreon.com/oauth2/errors?error=invalid_request_description=Mismatching+redirect+URI.=z5ycBAl8AI5V
and in my HTML Body I get: 
{"error":"invalid_request","error_description":"Mismatching redirect 
URI.","state":"z5ycBAl8AI5V"}


On Tuesday, October 27, 2020 at 9:28:38 AM UTC-4 Ryan Nowakowski wrote:

> On Mon, Oct 26, 2020 at 12:16:03PM -0700, Andrew Stringfield wrote:
> > Hello all,
> > 
> > I am trying to use Patreon's API Version 2 with Django 3.1. I 
> > read: https://docs.patreon.com/#third-party-libraries and found that 
> > Patreon supported the django-allauth library. I installed the library by 
> > following the instructions 
> > of: https://django-allauth.readthedocs.io/en/latest/installation.html. 
> I 
> > start up the default dev server and I go 
> > to http://127.0.0.1:8000/accounts/signup/ and fill out the form and hit 
> > submit. I get the response of:
> > -
> > Page not found (404)Request Method:
> > GETRequest URL:
> > http://127.0.0.1:8000/accounts/profile/
> > 
> > Using the URLconf defined in mysite.urls, Django tried these URL 
> patterns, 
> > in this order:
> > 
> > 1. admin/
> > 2. accounts/ signup/ [name='account_signup']
> > 3. accounts/ login/ [name='account_login']
> > 4. accounts/ logout/ [name='account_logout']
> > 5. accounts/ password/change/ [name='account_change_password']
> > 6. accounts/ password/set/ [name='account_set_password']
> > 7. accounts/ inactive/ [name='account_inactive']
> > 8. accounts/ email/ [name='account_email']
> > 9. accounts/ confirm-email/ [name='account_email_verification_sent']
> > 10. accounts/ ^confirm-email/(?P[-:\w]+)/$ 
> > [name='account_confirm_email']
> > 11. accounts/ password/reset/ [name='account_reset_password']
> > 12. accounts/ password/reset/done/ [name='account_reset_password_done']
> > 13. accounts/ ^password/reset/key/(?P[0-9A-Za-z]+)-(?P.+)/$ 
> > [name='account_reset_password_from_key']
> > 14. accounts/ password/reset/key/done/ 
> > [name='account_reset_password_from_key_done']
> > 15. accounts/ social/
> > 16. accounts/ patreon/
> > 
> > The current path, accounts/profile/, didn't match any of these.
>
> That's the default LOGIN_REDIRECT_URL[1]. Explicitly set that in your
> settings.py to wherever you want the user to land after login succeeds.
>
> [1] https://docs.djangoproject.com/en/3.1/ref/settings/#login-redirect-url
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/44335b22-d73d-4ab9-9a13-b01a2cd2f6c2n%40googlegroups.com.


Re: Patreon and Django-AllAuth Integration

2020-10-26 Thread Andrew Stringfield
First, thank you for the response!  I want to use Patreon as a login 
account provider for my Patrons.  I have been playing around with the code 
some more.  This is what I have so far:

I created a view with the contents of:
def patreon(request):
request_string = 'http://patreon.com/oauth2/authorize'
request_string = request_string + '?response_type=code'
request_string = request_string + '_id=KEY_VARIABLE'
request_string = request_string + 
'_uri=http://website_name.com'
print(request_string)
response = requests.get(request_string)
print(response)
-
The print(response) produces: .  I looked up this error 
code and found: "403 Forbidden -- The requested is hidden for 
administrators only." at the URL of: https://docs.patreon.com/?python#errors
Please also note that the website_name.com is not currently online at this 
time.  If, I need to make it online, I can.
On Monday, October 26, 2020 at 4:33:16 PM UTC-4 andrea...@hypercode.se 
wrote:

> Hi,
>
> Django-allauth is used for handling login from SSO third party libraries - 
> EXACTLY what you are getting a response from.
>
> Do you want to use Patreon as a login account provider or do you want to 
> do something else?
>
> Regards,
>
> Andréas
>
>
> Den mån 26 okt. 2020 kl 20:47 skrev Andrew Stringfield <
> thefund...@gmail.com>:
>
>> Hello all,
>>
>> I am trying to use Patreon's API Version 2 with Django 3.1.  I read: 
>> https://docs.patreon.com/#third-party-libraries and found that Patreon 
>> supported the django-allauth library.  I installed the library by following 
>> the instructions of: 
>> https://django-allauth.readthedocs.io/en/latest/installation.html.  I 
>> start up the default dev server and I go to 
>> http://127.0.0.1:8000/accounts/signup/ and fill out the form and hit 
>> submit.  I get the response of:
>> -
>> Page not found (404)Request Method:
>> GETRequest URL:
>> http://127.0.0.1:8000/accounts/profile/
>>
>> Using the URLconf defined in mysite.urls, Django tried these URL 
>> patterns, in this order:
>>
>>1. admin/
>>2. accounts/ signup/ [name='account_signup']
>>3. accounts/ login/ [name='account_login']
>>4. accounts/ logout/ [name='account_logout']
>>5. accounts/ password/change/ [name='account_change_password']
>>6. accounts/ password/set/ [name='account_set_password']
>>7. accounts/ inactive/ [name='account_inactive']
>>8. accounts/ email/ [name='account_email']
>>9. accounts/ confirm-email/ [name='account_email_verification_sent']
>>10. accounts/ ^confirm-email/(?P[-:\w]+)/$ 
>>[name='account_confirm_email']
>>11. accounts/ password/reset/ [name='account_reset_password']
>>12. accounts/ password/reset/done/ 
>>[name='account_reset_password_done']
>>13. accounts/ 
>>^password/reset/key/(?P[0-9A-Za-z]+)-(?P.+)/$ 
>>[name='account_reset_password_from_key']
>>14. accounts/ password/reset/key/done/ 
>>[name='account_reset_password_from_key_done']
>>15. accounts/ social/
>>16. accounts/ patreon/
>>
>> The current path, accounts/profile/, didn't match any of these.
>>
>> You're seeing this error because you have DEBUG = True in your Django 
>> settings file. Change that to False, and Django will display a standard 404 
>> page.
>>
>> -
>>
>> I want to get data from Patreon, but it looks like I am just creating 
>> local user accounts in the database.  What am I doing wrong?
>>
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/090d5b8f-d8cf-4ba7-86b1-35017dec2397n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/090d5b8f-d8cf-4ba7-86b1-35017dec2397n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ae46d39c-2b41-4c25-8cdf-11772ca7ebc5n%40googlegroups.com.


Patreon and Django-AllAuth Integration

2020-10-26 Thread Andrew Stringfield
Hello all,

I am trying to use Patreon's API Version 2 with Django 3.1.  I 
read: https://docs.patreon.com/#third-party-libraries and found that 
Patreon supported the django-allauth library.  I installed the library by 
following the instructions 
of: https://django-allauth.readthedocs.io/en/latest/installation.html.  I 
start up the default dev server and I go 
to http://127.0.0.1:8000/accounts/signup/ and fill out the form and hit 
submit.  I get the response of:
-
Page not found (404)Request Method:
GETRequest URL:
http://127.0.0.1:8000/accounts/profile/

Using the URLconf defined in mysite.urls, Django tried these URL patterns, 
in this order:

   1. admin/
   2. accounts/ signup/ [name='account_signup']
   3. accounts/ login/ [name='account_login']
   4. accounts/ logout/ [name='account_logout']
   5. accounts/ password/change/ [name='account_change_password']
   6. accounts/ password/set/ [name='account_set_password']
   7. accounts/ inactive/ [name='account_inactive']
   8. accounts/ email/ [name='account_email']
   9. accounts/ confirm-email/ [name='account_email_verification_sent']
   10. accounts/ ^confirm-email/(?P[-:\w]+)/$ 
   [name='account_confirm_email']
   11. accounts/ password/reset/ [name='account_reset_password']
   12. accounts/ password/reset/done/ [name='account_reset_password_done']
   13. accounts/ ^password/reset/key/(?P[0-9A-Za-z]+)-(?P.+)/$ 
   [name='account_reset_password_from_key']
   14. accounts/ password/reset/key/done/ 
   [name='account_reset_password_from_key_done']
   15. accounts/ social/
   16. accounts/ patreon/

The current path, accounts/profile/, didn't match any of these.

You're seeing this error because you have DEBUG = True in your Django 
settings file. Change that to False, and Django will display a standard 404 
page.

-

I want to get data from Patreon, but it looks like I am just creating local 
user accounts in the database.  What am I doing wrong?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/090d5b8f-d8cf-4ba7-86b1-35017dec2397n%40googlegroups.com.


Shouldn't there be a library already for how to render your JS Frontend code into HTML and then insert your Django templates with jinja2 very easily?

2020-06-18 Thread Andrew


Hi all! I'm no frontend person, but I do help triage issues in 
djangorestframework-simplejwt. It's probably one of the most used 
authentication library for DRF users and most of all frontend framework 
devs of Django (i.e. React, Angular, Vue).

I've been getting lots of comments about issue #157 
<https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/157> not 
getting merged. I'm still not convinced that it should be merged at this 
point, but I'm wondering if there's a better way for these frontend 
framework JS devs to integrate with Django sessions.

Again, I'm no frontend JS person. In fact, I've never actually coded with 
React or any of these frameworks before (I just generally know enough how 
most integrate with Django). But looking into the techs themselves, 
shouldn't there be a way to render the HTML content on python manage.py 
runserver (or however way you're deploying with something like gunicorn), 
map out where you want to put your template tags (like you code with the JS 
tech and a library inserts where you want the tags or variables), and then 
voila... you can use the sessions middlewear?

If this hasn't been done, someone should make it happen... If enough 
attention comes by for a better idea, I'd love to help collaborate!

My GitHub page: https://github.com/Andrew-Chen-Wang

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4e8d86c3-1f02-4572-b447-ed4639858248n%40googlegroups.com.


Re: Channels/Daphne offloading SSL Certs to AWS ELB fails to establish socket

2020-04-21 Thread Andrew C.
I’m about to create a PR (or not, not sure) with an AWS ALB setup for
cookiecutter django. The gist of it really is that there’s an article my
msaizar that has a good nginx configuration setup. Remove traefik and add
nginx. Your target group in AWS should have all machines registered on port
80 and you should be good to go. There’s a little more to what I’ve said,
but that’s the gist of it.

On Tue, Apr 21, 2020 at 12:25 PM Shaheed Haque 
wrote:

> On Tue, 21 Apr 2020 at 00:30, Tim Nelson  wrote:
>
>> Well if you want the clients IP logged or need to do something with it on
>> the request:
>>
>>set_real_ip_from 0.0.0.0/0;
>>real_ip_header X-Forwarded-For;
>>real_ip_recursive on;
>>
>
> Thanks for the tip. I'll have to look into those in due course.
>
> Shaheed
>
>
>>
>> On Mon, Apr 20, 2020 at 5:55 PM Shaheed Haque 
>> wrote:
>>
>>>
>>>
>>> On Mon, 20 Apr 2020 at 21:54, Filbert  wrote:
>>>
 *Answering my own question.AWS classic ELBs never worked properly
 with websockets. Need to convert them to ALBs.*

>>>
>>> Thanks for closing the loop; this is quite likely to be in my future.
>>> Did you need any nginx config changes?
>>>
>>> Shaheed
>>>
>>> On Tuesday, April 14, 2020 at 5:37:54 PM UTC-4, Filbert wrote:
>
> Using AWS ELB, I was able to serve HTTP (via uwsgi) and websockets
> through Nginx with Nginx handling the SSL certs.
>
> Once I tried to offloading SSL certs to the ELB so I could capture
> X-Forwarded-For, websockets fail to route/upgrade to Daphne and I get "Not
> Found: /ws/" in uwsgi's logs.
>
> Here is the relevant (working) piece of Nginx .conf file using TCP/443
> pass thru from the ELB:
>
> location /ws {
> proxy_pass http://unix:/opt/toogo/run/r117.0.4.3720.ws;
>  #Obviously daphne is listening here
> proxy_set_header Upgrade $http_upgrade;
> proxy_set_header Connection "upgrade";
> proxy_http_version 1.1;
> proxy_set_header X-Forwarded-For
> $proxy_add_x_forwarded_for;
> proxy_set_header Host $host;
> }
>
> What change is required if I offload the SSL certs to the ELB and
> introduce X-Forwarded-for?
>
 --
 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 view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/305b31ae-ff69-425a-a173-645c55ba07a1%40googlegroups.com
 
 .

>>>
>>> --
>>> 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/iNoIPxDgv90/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAHAc2jf1KNYe-p2JM-XLD2q8HpC_29oNrJ24KkyjVFRj%2BpPo%2BQ%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAK09zoq2pD6MsMfXA6y_rj4CUvcxgrT-w11xYCSvaUjdm8TD_Q%40mail.gmail.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHAc2jcGo1YFJhJNf%2Bt1BfhD60dG%3DwUaamU5M9Wg_ksAm4HWaQ%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 

Re: i want to change database sqllite to mysql but show error

2020-04-12 Thread Andrew Fetting
Have you tried
pip3 install mysqlclient

On Sun, Apr 12, 2020, 7:36 AM Arun Sharma  wrote:

> python manage.py runserver
>
>
>
> Watching for file changes with StatReloader
> Exception in thread django-main-thread:
> Traceback (most recent call last):
>   File
> "C:\Users\Arunkumar\PycharmProjects\app2\venv\lib\site-packages\django\db\backends\mysql\base.py",
> line 16, in
> 
> import MySQLdb as Database
> ModuleNotFoundError: No module named 'MySQLdb'
>
> The above exception was the direct cause of the following exception:
>
> Traceback (most recent call last):
>   File
> "C:\Users\Arunkumar\AppData\Local\Programs\Python\Python37-32\lib\threading.py",
> line 926, in _bootstrap_inner
> self.run()
>   File
> "C:\Users\Arunkumar\AppData\Local\Programs\Python\Python37-32\lib\threading.py",
> line 870, in run
> self._target(*self._args, **self._kwargs)
>   File
> "C:\Users\Arunkumar\PycharmProjects\app2\venv\lib\site-packages\django\utils\autoreload.py",
> line 53, in wrappe
> r
> fn(*args, **kwargs)
>   File
> "C:\Users\Arunkumar\PycharmProjects\app2\venv\lib\site-packages\django\core\management\commands\runserver.py",
> line 109, in inner_run
> autoreload.raise_last_exception()
>   File
> "C:\Users\Arunkumar\PycharmProjects\app2\venv\lib\site-packages\django\utils\autoreload.py",
> line 76, in raise_
> last_exception
> raise _exception[1]
>   File
> "C:\Users\Arunkumar\PycharmProjects\app2\venv\lib\site-packages\django\core\management\__init__.py",
> line 357,
> in execute
> autoreload.check_errors(django.setup)()
>   File
> "C:\Users\Arunkumar\PycharmProjects\app2\venv\lib\site-packages\django\utils\autoreload.py",
> line 53, in wrappe
> r
> fn(*args, **kwargs)
>   File
> "C:\Users\Arunkumar\PycharmProjects\app2\venv\lib\site-packages\django\__init__.py",
> line 24, in setup
> apps.populate(settings.INSTALLED_APPS)
>   File
> "C:\Users\Arunkumar\PycharmProjects\app2\venv\lib\site-packages\django\apps\registry.py",
> line 114, in populate
>
> app_config.import_models()
>   File
> "C:\Users\Arunkumar\PycharmProjects\app2\venv\lib\site-packages\django\apps\config.py",
> line 211, in import_mod
> els
> self.models_module = import_module(models_module_name)
>   File
> "C:\Users\Arunkumar\AppData\Local\Programs\Python\Python37-32\lib\importlib\__init__.py",
> line 127, in import_m
> odule
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 1006, in _gcd_import
>   File "", line 983, in _find_and_load
>   File "", line 967, in
> _find_and_load_unlocked
>   File "", line 677, in _load_unlocked
>   File "", line 728, in exec_module
>   File "", line 219, in
> _call_with_frames_removed
>   File "C:\Users\Arunkumar\PycharmProjects\app2\project\models.py", line
> 4, in 
> class Project(models.Model):
>   File
> "C:\Users\Arunkumar\PycharmProjects\app2\venv\lib\site-packages\django\db\models\base.py",
> line 121, in __new__
>
> new_class.add_to_class('_meta', Options(meta, app_label))
>   File
> "C:\Users\Arunkumar\PycharmProjects\app2\venv\lib\site-packages\django\db\models\base.py",
> line 325, in add_to_
> class
> value.contribute_to_class(cls, name)
>   File
> "C:\Users\Arunkumar\PycharmProjects\app2\venv\lib\site-packages\django\db\models\options.py",
> line 208, in cont
> ribute_to_class
> self.db_table = truncate_name(self.db_table,
> connection.ops.max_name_length())
>   File
> "C:\Users\Arunkumar\PycharmProjects\app2\venv\lib\site-packages\django\db\__init__.py",
> line 28, in __getattr__
>
> return getattr(connections[DEFAULT_DB_ALIAS], item)
>   File
> "C:\Users\Arunkumar\PycharmProjects\app2\venv\lib\site-packages\django\db\utils.py",
> line 207, in __getitem__
> backend = load_backend(db['ENGINE'])
>   File
> "C:\Users\Arunkumar\PycharmProjects\app2\venv\lib\site-packages\django\db\utils.py",
> line 111, in load_backend
> return import_module('%s.base' % backend_name)
>   File
> "C:\Users\Arunkumar\AppData\Local\Programs\Python\Python37-32\lib\importlib\__init__.py",
> line 127, in import_m
> odule
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 1006, in _gcd_import
>   File "", line 983, in _find_and_load
>   File "", line 967, in
> _find_and_load_unlocked
>   File "", line 677, in _load_unlocked
>   File "", line 728, in exec_module
>   File "", line 219, in
> _call_with_frames_removed
>   File
> "C:\Users\Arunkumar\PycharmProjects\app2\venv\lib\site-packages\django\db\backends\mysql\base.py",
> line 21, in
> 
> ) from err
> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
> Did you install mysqlclient?
>
>
>
>
>
>
>
>
>
>
> pip install mysqlclient
> Collecting mysqlclient
>   Using cached
> https://files.pythonhosted.org/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e
> 03a/mysqlclient-1.4.6.tar.gz
> Installing collected packages: mysqlclient
>   Running setup.py install for mysqlclient ... error
> Complete 

Re: 502 Bad Gateway nginx/1.14.0 (Ubuntu)

2020-04-11 Thread Andrew C.
What’s the HTTP status code? Does the nginx page even show anything? Try:

sudo systemctl stop nginx && sudo systemctl disable nginx && sudo systemctl
enable nginx && sudo systemctl start nginx

This command could also be in the wrong order... it’s been awhile.

It could be a symbolic link error. I don’t know. If you see some web page
with an error message like Internal Error 500 or the default nginx page,
let us know.

On Sat, Apr 11, 2020 at 1:39 PM Jagtar Singh Lakhyan <
jagtar.lakhe...@gmail.com> wrote:

> sudo systemctl status nginx
>
> *●* nginx.service - A high performance web server and a reverse proxy
> server
>
>Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor
> preset: enabled)
>
>Active: *active (running)* since Sat 2020-04-11 04:54:18 IST; 18h ago
>
>  Docs: man:nginx(8)
>
>   Process: 1650 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry
> QUIT/5 --pidfi
>
>   Process: 1652 ExecStart=/usr/sbin/nginx -g daemon on; master_process
> on; (code=exite
>
>   Process: 1651 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on;
> master_process on; (c
>
>  Main PID: 1653 (nginx)
>
> Tasks: 9 (limit: 1689)
>
>CGroup: /system.slice/nginx.service
>
>├─1653 nginx: master process /usr/sbin/nginx -g daemon on;
> master_process o
>
>├─1654 nginx: worker process
>
>├─1655 nginx: worker process
>
>├─1656 nginx: worker process
>
>├─1657 nginx: worker process
>
>├─1658 nginx: worker process
>
>├─1659 nginx: worker process
>
>├─1660 nginx: worker process
>
>└─1661 nginx: worker process
>
>
> Apr 11 04:54:18 wms systemd[1]: Starting A high performance web server and
> a reverse p
>
> Apr 11 04:54:18 wms systemd[1]: Started A high performance web server and
> a reverse pr
>
> On Sat, Apr 11, 2020 at 11:07 PM Rok Klancar  wrote:
>
>> Dude, try "sudo systemctl status nginx"
>>
>> Dne sobota, 11. april 2020 18.53.50 UTC+2 je oseba Jagtar Singh Lakhyan
>> napisala:
>>>
>>> Im trying to deploy django app using nginx & gunicorn but its showing
>>> error
>>>
>>> sudo nginx -t
>>>
>>> nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
>>>
>>> nginx: configuration file /etc/nginx/nginx.conf test is successful
>>>
>>>
>>> sudo systemctl status gunicorn.service
>>>
>>> gunicorn.service - gunicorn service
>>>
>>>Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled;
>>> vendor preset:
>>>
>>>Active: *active (running)* since Sat 2020-04-11 21:19:19 IST; 11s ago
>>>
>>>  Main PID: 16326 (gunicorn)
>>>
>>> Tasks: 4 (limit: 1689)
>>>
>>>
>>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/a3223d66-8adb-4dcd-8a48-d43d8a426ddc%40googlegroups.com
>> 
>> .
>>
>
>
> --
>
> *jagtar singh*founder & CEO
> LinkedIn 
> Twitter 
>
> web 1: Network 
> web 2: WMS 
> web 3: Conference 
>
> Android App 1: Network
> 
> Android App 2: WMS
> 
> Android App 3: Conference
> 
>
> LinkedIn
> 
> LinkedIn2 
> Twitter 
> *IITIAN'S ADVANCED SCHOOL OF COMPETITION PVT. LTD.
> *
>
> 
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAD1gXQEbzWSWvSrQOCb-nBDcHzYb6ZE_qx4Hg6pJ_XJN3HN13Q%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 

Re: In pycharm errror

2020-04-10 Thread Andrew Fetting
Sounds like you are on file too deep. manage.py should be in {project
name}\manage.py, not {project name}\{project name}\manage.py.
Hope that helps.

On Fri, Apr 10, 2020 at 5:23 PM Jatin Agrawal  wrote:

> Can you please post an image of your directory structure? Maybe then I or
> someone else can help you in a better way.
>
>
> On Thursday, April 9, 2020 at 7:55:20 PM UTC+5:30, tejasri mamidi wrote:
>>
>> While executing py manage.py runserver ..
>> Terminal showing this file will not found why..
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2af77eef-71f4-4716-96be-72b3871906ec%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOn-tti7Ej8AhT%3Dvgei8NMhKWeEzb9k5DUeaRRDNm_b2txCgWg%40mail.gmail.com.


Re: How to Setup DjangoRestFrameWork with Mongo DB

2020-03-28 Thread Andrew C.
I highly recommend not using MongoDB. Sure, they can plaster a banner
saying “Google supports us” but many industry leaders have tried and failed
using it. It can’t store data that easily once you grow, making it unlikely
for usage in the future for employment by any startup or corporation and
for any realistic goal of scaling, too.

Use PostgreSQL’s NoSQL style with JSONB (JSONField) if you have to, and, if
you really need to index it, use a GIN index. Postgres is battle tested,
whereas Mongo is battle defeated.

I’d suggest you get to understand SQL vs. NoSQL first. Understand what’s
actually needed as an attribute and what isn’t. Most of the time, what you
think is non relational becomes relational. You can think partitioning and
sharding.

Sometimes you have to use NoSQL like with user profiles in which some
fields aren’t required. Use a JSONField, because I bet the REST of your
data is still relational.

Follow the general rules of why this works out. Not that people don’t use a
full NoSQL db like cassandra, but they use it for different use cases (like
throttling).

On Sat, Mar 28, 2020 at 4:28 AM VenkataSivaRamiReddy <
vennavenkat...@gmail.com> wrote:

> i tried but not getting
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGiJVX02pxupk5p1%2B%2Br393icjT9VgtpPLqRCxK-1AV1oo9BfvQ%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJVmkN%3DDJXwTeA4YNY1HUUzMq9rBdkhNJtZFX-bOm23CH341ww%40mail.gmail.com.


Re: Online money transfer

2020-03-27 Thread Andrew C.
Stripe is the best imo

On Fri, Mar 27, 2020 at 12:49 PM Motaz Hejaze  wrote:

> Any ideas guys
>
> On Fri, 27 Mar 2020, 3:07 pm Motaz Hejaze,  wrote:
>
>> Hi friends ,
>> What is the best and easiest way to implement money transfer from visa to
>> visa and from visa to bank account ??
>> And how to link it with user accounts ..
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/bc12ecb9-aa36-49bc-ab49-506299bf905c%40googlegroups.com
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHV4E-fV3YFqR45wORU1%2BLbzE5Aq-JCJto%3DOsEsgN1TzH-UkyA%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJVmkNnWUn61JPg%2BKQX-EdESXF-e%3D27%3DMqU%3DiYZK916_%3DKJTkg%40mail.gmail.com.


Re: AWS API or EC2 for chat?

2020-03-24 Thread Andrew C.
I’ve figured my original question out. API Gateway is usually paired with
Lambda. They scale easily, but I’m pretty much expecting 24/7 usage, which
Lambda isn’t the best option for(???). I use cookiecutter-django, so I’ll
be using ECS. Unfortunately, costs are sky high... If anyone’s able to help
me out any further regarding costs, please do so. Thanks!

I can provide one last hint. 1) understand what AnonymousUser model is. 2)
Look at
https://github.com/SimpleJWT/django-rest-framework-simplejwt/blob/master/rest_framework_simplejwt/models.py#L31

On Tue, Mar 24, 2020 at 11:19 PM Motaz Hejaze  wrote:

> That was unexpected , i thaught about using python module socketio
>
> On Wed, 25 Mar 2020, 5:08 am Andrew C.,  wrote:
>
>> The only hint I can freely provide is to use celery tasks. They let you
>> do taskname.delay(pk_user1, for_chat_pk). You  can look online for an
>> article with the url dev.to to setup your asgi.py file. That’s all I can
>> freely give out, though. Good luck!
>>
>> On Tue, Mar 24, 2020 at 10:40 PM Motaz Hejaze 
>> wrote:
>>
>>> Any hint how you built the chat without channels ? Because i realy hate
>>> its complixity ..
>>>
>>> On Wed, 25 Mar 2020, 4:30 am Yoo,  wrote:
>>>
>>>> Hi all! I built a chat app without dj channels, but now I’m stuck with
>>>> pricing... and just AWS in general. Every time I look up Websockets, I’m
>>>> told to use AWS API Gateway. Why? And if so, how would I split my project
>>>> between EC2 for website and API Gateway for my mobile users and for chats?
>>>>
>>>> Or am I comparing the wrong things? Is the comparison between gateway
>>>> and load balancer?
>>>>
>>>> --
>>>> 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 view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/0babe8f3-1472-4bae-bab9-73e265969a87%40googlegroups.com
>>>> .
>>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAHV4E-f%2B%3DTTw8b-bC7ZN92VR5yizSOQhTfFKsj0FePCVbg1SGw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAHV4E-f%2B%3DTTw8b-bC7ZN92VR5yizSOQhTfFKsj0FePCVbg1SGw%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAJVmkNk-g8SLwebURgnFxd4qHBf2nGe9%2B%2B%3DXaWd1xa1M%2BfSzXw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAJVmkNk-g8SLwebURgnFxd4qHBf2nGe9%2B%2B%3DXaWd1xa1M%2BfSzXw%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHV4E-frCXULNWRinkJ4h3MBrb1LGHbnS%2Bgvxp9U9m996c_MyA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHV4E-frCXULNWRinkJ4h3MBrb1LGHbnS%2Bgvxp9U9m996c_MyA%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJVmkNkOuj%2BYj_J-rV2bTooZz0xjayam76kuOeXuP56tAXDOuw%40mail.gmail.com.


Re: AWS API or EC2 for chat?

2020-03-24 Thread Andrew C.
The only hint I can freely provide is to use celery tasks. They let you do
taskname.delay(pk_user1, for_chat_pk). You  can look online for an article
with the url dev.to to setup your asgi.py file. That’s all I can freely
give out, though. Good luck!

On Tue, Mar 24, 2020 at 10:40 PM Motaz Hejaze  wrote:

> Any hint how you built the chat without channels ? Because i realy hate
> its complixity ..
>
> On Wed, 25 Mar 2020, 4:30 am Yoo,  wrote:
>
>> Hi all! I built a chat app without dj channels, but now I’m stuck with
>> pricing... and just AWS in general. Every time I look up Websockets, I’m
>> told to use AWS API Gateway. Why? And if so, how would I split my project
>> between EC2 for website and API Gateway for my mobile users and for chats?
>>
>> Or am I comparing the wrong things? Is the comparison between gateway and
>> load balancer?
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/0babe8f3-1472-4bae-bab9-73e265969a87%40googlegroups.com
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHV4E-f%2B%3DTTw8b-bC7ZN92VR5yizSOQhTfFKsj0FePCVbg1SGw%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJVmkNk-g8SLwebURgnFxd4qHBf2nGe9%2B%2B%3DXaWd1xa1M%2BfSzXw%40mail.gmail.com.


Re: write a new app

2020-03-19 Thread Andrew C.
If you want to avoid web frontend, then stick to mobile app development.
DRF as someone else mentioned helps. I recommend front end development
because they have guidelines and make thing easier to implement (iOS is
much much easier). You can’t make a usable app without doing both frontend
and backend.

As the last person said, do a project that helps your community. Don’t
think big, or a million dollar app idea, or money in general. Think
impactfulness on YOUR community only.

Backend code is not revolutionary. If you want business logic to be
revolutionary, then find a computer engineering job or code a huge
algorithm. Django and Flask are meant to be full-stack development
packages. When you get a job, you can think backend only, sure, but you’re
asking for a USABLE app; thus, my second paragraph still stands.

On Wed, Mar 18, 2020 at 1:27 PM Mohsen Pahlevanzadeh <
m.pahlevanza...@gmail.com> wrote:

> Dear All,
>
> I need to write an real app for my CV, But I want to write a usable
> app, Not just a app for upload in github. What do you recommend? Of
> course , I don't want to code html/css and js. I want to write only
> back-end.
>
>
> --mohsen
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJFFGZ%2BfbfpUow9zbJR1AC_cO1gTuCu_4ORcebi7KaEkxWPP7w%40mail.gmail.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJVmkNm0K7F78OJUO2WwtS8abbWiPgi60fX6wRyq5yaUrBx_mg%40mail.gmail.com.


Re: Django channel and gunicorn

2020-03-19 Thread Andrew C.
Install uvicorn. Easy integration with gunicorn. There’s a good article
about how to setup your Djsngo 3.0 async websocket app online too now.

On Thu, Mar 19, 2020 at 3:32 AM Suraj Thapa FC 
wrote:

> You can't use gunicorn with django channels...
> Use Daphne or uwsgi etc
>
> On Wed, 18 Mar 2020, 11:49 pm N'BE SORO,  wrote:
>
>> hi i have a problem with django channel and gunicorn.
>>
>> I don't know how to configure my project so that the websocket can pass.
>>
>>
>> thank you.
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAOtSHp9N%3DoDWVLuj-wK4Aqi6b5AqmLfB_wB14OjoGeza3Y5cdw%40mail.gmail.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPjsHcFrkONm0ZwLvMSyGUxojPcALDRZ8xv56ccY7sr5POVHQg%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJVmkNmfJfbLQyjO57Uvu2cXBHPmNi5O2RzU-2t6AtsoOxhV3w%40mail.gmail.com.


drop image in div and add path to db

2020-03-12 Thread Andrew Fry
Hi all... newbie here.

I have jQuery drag 'n drop working for a web app but cannot seem to figure 
out how to get the path of the dropped image uploaded to my db.sqlite3 
database.

What do I need to provide to get some help.

Thanks in advance.
-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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/25d19905-b329-4222-bb58-8e4a2a3b966d%40googlegroups.com.


Re: Channels, daphne, and asgiref, oh my!

2020-02-21 Thread Andrew Godwin
Hi Larry,

Your problem is the Python version - 3.5 is somewhat old (but most
importantly, was still a very rough release for asyncio) and isn't
supported by any current release of asgiref/channels for that reason. If
you are able to upgrade that, I very much recommend it.

Andrew

On Sat, Feb 22, 2020 at 2:52 AM Aldian Fazrihady  wrote:

> I have these working module combinations, but my Python is 3.6.9:
> asgiref==2.2.0
> channels==2.0.2
> channels_redis==2.3.0
> daphne==2.1.0
> Django==2.2.4
> django-redis==4.10.0
> redis==3.3.6
> Twisted[tls,http2]
> uwsgi==2.0.18
> websockets==6.0
>
> On Sat, Feb 22, 2020 at 3:25 AM Larry Martell 
> wrote:
>
>> I am in a bit of version hell. Not fun on a Friday afternoon.
>>
>> Django 2.0.4, python 3.5.2
>>
>> Trying to get channels, websockets, daphne, and asgiref working.
>>
>> When I installed the latest channels it did not work with my version
>> of mysqlclient and some googling led me to install 2.0 of channels.
>> That worked fine with the dev server, and then I wanted to deploy my
>> app in prod. In prod we use nginx/uwsgi so I was going to replace
>> uwsgi with daphne. When I tried to run daphne I got:
>>
>> ImportError: No module named 'asgiref.compatibility'
>>
>> Googling that I was led to upgrade asgiref to the latest version.
>> After I did that I got:
>>
>> AttributeError: module 'asyncio.coroutines' has no attribute
>> '_is_coroutine'
>>
>> Have not been able to get past this one.
>>
>> Anyone have any thoughts? Would upgrading django and python fix these
>> issues? I am planning on doing that soon, but I was not planning on
>> doing that now. Don't want to upgrade now and then find I still have
>> issues. Can I get all this to work with my current versions and
>> upgrade later?
>>
>> TIA!
>> Larry
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CACwCsY5SQzRG-7EuEM8rZvOfQor5bBOjt%3DBV1Qsbn9%2BBhMx12g%40mail.gmail.com
>> .
>>
>
>
> --
> Regards,
>
> Aldian Fazrihady
> http://aldianfazrihady.com
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAN7EoAbSAVUT%3D8sg1o-0oczCfjfRhtGwrMDE31YBt9N%2Bm96YmA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAN7EoAbSAVUT%3D8sg1o-0oczCfjfRhtGwrMDE31YBt9N%2Bm96YmA%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFwN1up5WAkwAVrasG%2BgG6ia8JSru1sMjJnckiCP8kbsVK-JiA%40mail.gmail.com.


Re: is there a WYSIWYG for Django

2020-02-08 Thread Andrew C.
Try Quill.js. If you google Quill.js and Quill.js Django, I believe
you'll find the Django package that goes along with that text editor.
Really, you only need the Quill.js code for your template. WYSIWYG is
just a user typing in HTML without realizing it. Just save the HTML
(because the rest is escaped while the user is typing).

It's also useful if you escape all instances of a script tag in case
someone inputs an unescaped . Your server wouldn't be
destroyed necessarily, but there could be some XSS that you want to
avoid.

On 2/8/20, john  wrote:
> Hi,
>
> I realize that Django does not have a frontend but is there a
> tool/package that works well for WYSIWYG a simple website?
>
> Johnf
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/da5f5c36-0bca-4a47-d91d-5c67b657c7a5%40jfcomputer.com.
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJVmkNnMhBbrjG-stwWor91zRKJyhXL9PfSds7CiPYV-E4hEvA%40mail.gmail.com.


Re: JSONField() ordering and removing latest

2020-02-04 Thread Andrew C.
Usually, something that has multiple versions could be in an autoincrement
field as the primary key. Then, in a JSONB field with GIN index (since
you’re using PostgreSQL), you would have a dict of each version, like this:

{
“1”: { # beginning of article 1
“versions”: {

“1”: {
“title”: “Blah1”,
“timestamp”: 172903740.0002782,
“image”: “http:test.de/test.jpg”,
“alt”: “Super text”
}, # end of version 1
“2”: {
“title”: “Blah1”,
“timestamp”: 1729375394.0002782,
“image”: “http:test.de/test.jpg”,
“alt”: “Super text blah”
}, # end of version 2
“3”: {
“title”: “Blah2”,
“timestamp”: 17290826300.0002782,
“image”: “http:test.de/test.jpg”,
“alt”: “Super text blah”
} # end of version 3

} # end of versions attribute/column
}, # end of article 1
“2”: {


“versions”: {

“1”: {
“title”: “Blah1”,
“timestamp”: 172903740.0002782,
“image”: “http:test.de/test.jpg”,
“alt”: “Super text”
}, # end of version 1
“2”: {
“title”: “Blah1”,
“timestamp”: 172903740.0002782,
“image”: “http:test.de/test.jpg”,
“alt”: “Super text blah”
} # end of version 2

} # end of article 2

} # end of queryset

So your primary key is a BigAutoField and your “versions” attribute/column
is a JSONField. IF YOU ARE FILTERING BASED ON ARTICLE TITLE, make sure you
put a GIN Index on that JSONField.

On Thu, Jan 30, 2020 at 10:38 AM wagner  wrote:

> Hello together,
> i have the following problem. I need to save different versions of an
> article in a json object:
>
> {
> "1580388458.2877874": {
> "title": "Erster Artikel",
> "text_block_with_image": [{"text": "Super Text der einen weiterhilft",
> "image": "http://test.de/test.jpg"}]
> },
>
> "1580388556.6462297": {
> "title": "Erster Artikel angepasst",
> "text_block_with_image": [{"text": "Super neuer neuer Text der einen
> weiterhilft", "image": "http://test.de/test.jpg"}]
> }
>
> }
>
> I save this information in a JSONField().
>
> The numbers here are the current time in seconds.
> I want to do an article template where i show the latest version of the
> article (by current time seconds).
>
> How can i filter after the latest version?
>
> Articles.objects.filter( ?? )
>
>
>
> My second problem:
>
> How can i delete the oldest version (key), when i add a new entry?
>
>
> Thank you!
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f0624188-fd77-4c50-acbe-b0c841043554%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJVmkNkauta7BFtSvjWZk4T%3DX6-974b9SKzP7x-wu%3D5WJha86Q%40mail.gmail.com.


Re: DjangoEveryDay. My practice website!

2020-01-29 Thread Andrew C.
So for Django, you would need to do both frontend and backend. In my
opinion, your “behavior” would be to start in the frontend. How do you send
your message?

Someone in the backend for database modeling would be thinking ‘how do I
organize my cases?’ and THEN think ‘how do I present it?’

On Tue, Jan 21, 2020 at 2:22 PM Jack Lin  wrote:

> My Major is information and communication. Kind of Mass Communication but
> we made our content more specific to internet world.
> I’m not really sure what you mean in
> “and importantly how you think contributes to a certain type — or even
> workflow or stack — of learning in CS. “
> "tying in what you know, how you behave," You mean like do some projects
> for my own area?
>
>
> 在 2020年1月21日 於 上午12:47:09, Andrew C. (andreke12...@gmail.com) 寫下:
>
> What is your major? Usually tying in what you know, how you behave, and
> importantly how you think contributes to a certain type — or even workflow
> or stack — of learning in CS.
>
> On Mon, Jan 20, 2020 at 1:52 AM Jack Lin  wrote:
>
>> I’m not sure what this gonna be in the future. I think I’m just exlpore
>> the way.
>> I may want to make this reusable for the newbie in the future and make
>> the community better.
>> Open to any ideas and contribution.
>>
>>
>> 在 2020年1月20日 於 下午2:49:48, Jack Lin (tkic...@gmail.com) 寫下:
>>
>> Oh yes, this is all on Github. I’ll update the page to include GitHub
>> link today! Thanks for reminding.
>>
>>
>> 在 2020年1月20日 於 上午1:43:43, Balaji Shetty (balajishe...@gmail.com) 寫下:
>>
>> Great
>>
>> We follow you means ...
>>
>> Are you making code available on github to improve further..
>>
>> On Sunday, January 19, 2020, Jack Lin  wrote:
>>
>>> Hi everyone. I'm doing #DjangoEveryday Challenge to myself.
>>> I set a goal for everyday and try to accomplish it. So I got practice
>>> and progress everyday :)
>>>
>>> I'm doing this for preparation of my resume. I'm looking for Django Job
>>> in Taiwan but CS is not my major.
>>> I want to share this with you guys!
>>>
>>> btw, I do a bit of develop journal on my Linkedin, too. so if you are
>>> interested on my progression, you can follow me on Linkedin!
>>>
>>> There is the website: Jack's Practice Zone
>>> <https://afternoon-beach-38581.herokuapp.com>
>>> and this is my Linkedin
>>> <https://www.linkedin.com/in/jack-sanchez-677bb5168/> :)
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/fc2e047e-d362-4110-b6c5-9853402b0120%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/fc2e047e-d362-4110-b6c5-9853402b0120%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>>
>>
>> --
>> Mr Shetty Balaji
>> Asst. Prof.
>> IT Department
>> SGGS I
>> Nanded. My. India
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAECSbOtnvBqGo24hmoA5%2BA56P%2BtZ5VU5OBaSQpHm8VsdRE4sbg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAECSbOtnvBqGo24hmoA5%2BA56P%2BtZ5VU5OBaSQpHm8VsdRE4sbg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAP7OQq0QTXBWSP7WoKahq1ezh2S2hH9Akk96OQQp-XD0pE1pfA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAP7OQq0QTXBWSP7WoKahq1ezh2S2hH9Akk96OQQp-XD0pE1pfA%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> 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

Re: DjangoEveryDay. My practice website!

2020-01-29 Thread Andrew C.
“How you think” signifies your mindset. CS is for problem solvers. And even
if you don’t have that mindset, with mass communication (so sociology??),
you need to decide which stack you need to do. A stack, for your case,
could be frontend. You being a mads communication expert in the frontend
would design the User Interface and User Experience (UI/UX) using HTML,
CSS, JavaScript, etc. in order to communicate your message clearly.

The way a mass communicator thinks is how can I spread my message beyond
the internet, correct? Even with a focus on the Internet world, something
coming to fruition for you would be to send a global message.

On Tue, Jan 21, 2020 at 2:22 PM Jack Lin  wrote:

> My Major is information and communication. Kind of Mass Communication but
> we made our content more specific to internet world.
> I’m not really sure what you mean in
> “and importantly how you think contributes to a certain type — or even
> workflow or stack — of learning in CS. “
> "tying in what you know, how you behave," You mean like do some projects
> for my own area?
>
>
> 在 2020年1月21日 於 上午12:47:09, Andrew C. (andreke12...@gmail.com) 寫下:
>
> What is your major? Usually tying in what you know, how you behave, and
> importantly how you think contributes to a certain type — or even workflow
> or stack — of learning in CS.
>
> On Mon, Jan 20, 2020 at 1:52 AM Jack Lin  wrote:
>
>> I’m not sure what this gonna be in the future. I think I’m just exlpore
>> the way.
>> I may want to make this reusable for the newbie in the future and make
>> the community better.
>> Open to any ideas and contribution.
>>
>>
>> 在 2020年1月20日 於 下午2:49:48, Jack Lin (tkic...@gmail.com) 寫下:
>>
>> Oh yes, this is all on Github. I’ll update the page to include GitHub
>> link today! Thanks for reminding.
>>
>>
>> 在 2020年1月20日 於 上午1:43:43, Balaji Shetty (balajishe...@gmail.com) 寫下:
>>
>> Great
>>
>> We follow you means ...
>>
>> Are you making code available on github to improve further..
>>
>> On Sunday, January 19, 2020, Jack Lin  wrote:
>>
>>> Hi everyone. I'm doing #DjangoEveryday Challenge to myself.
>>> I set a goal for everyday and try to accomplish it. So I got practice
>>> and progress everyday :)
>>>
>>> I'm doing this for preparation of my resume. I'm looking for Django Job
>>> in Taiwan but CS is not my major.
>>> I want to share this with you guys!
>>>
>>> btw, I do a bit of develop journal on my Linkedin, too. so if you are
>>> interested on my progression, you can follow me on Linkedin!
>>>
>>> There is the website: Jack's Practice Zone
>>> <https://afternoon-beach-38581.herokuapp.com>
>>> and this is my Linkedin
>>> <https://www.linkedin.com/in/jack-sanchez-677bb5168/> :)
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/fc2e047e-d362-4110-b6c5-9853402b0120%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/fc2e047e-d362-4110-b6c5-9853402b0120%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>>
>>
>> --
>> Mr Shetty Balaji
>> Asst. Prof.
>> IT Department
>> SGGS I
>> Nanded. My. India
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAECSbOtnvBqGo24hmoA5%2BA56P%2BtZ5VU5OBaSQpHm8VsdRE4sbg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAECSbOtnvBqGo24hmoA5%2BA56P%2BtZ5VU5OBaSQpHm8VsdRE4sbg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAP7OQq0QTXBWSP7WoKahq1ezh2S2hH9Akk96OQQp-XD0pE1pfA%40mail.gmail.com
>> <https://gro

Re: open source advice needed

2020-01-29 Thread Andrew C.
Hi Kimberly,

I’ve taken a look at your preschool and school program, SNACS. Early in my
teen years, I helped set up [certain state in US] for an educational
bounce-back from zero funding to minimal, but the kid’s passions returned.
Django is a website framework, and I don’t think that’s what you're looking
for if you’re aiming for innovation. Or innovative learning.

Even with 300 students, I am skeptical of the model. I, for example, favor
large public education, but I do want to hear what SNACS is all about since
I would like to help implement some innovative learning strategies that I
didn’t find possible at a large scale.

But it depends on what your model is since your website never disclosed it.
Not to be negative, but it would be helpful to clear things up.

Best regards.

On Tue, Jan 28, 2020 at 7:18 PM Kimberly Regan  wrote:

> Hello,
> I have an idea that I pitched and placed 4th at the Harvard Zaentz Early
> Innovation Challenge. I've been implementing the model at my school for 20+
> years., The technology, a learning management system type program, will
> support the model to streamline procedures in classrooms toward effective
> and efficient student learning. I'm trying to find out what I need to do to
> find a developer, what language I use (meaning software specs), and how
> many people/hours would it take to develop it. I have a doctorate in
> education, but a newbie in technology development. A friend recommended I
> post a question to this site. Any ideas out there? 
> Thanks so much!
> Kimberly
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/540e150c-535b-45dd-a56e-345352bba167%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJVmkN%3DvXJVurF%3DXN9KUOMiAkeHv_Bd%3D2eTbFLU8xuVjPpaFYg%40mail.gmail.com.


Re: open source advice needed

2020-01-28 Thread Andrew C.
Hi Kimberly,

Django is mostly for website development. If you can tell us a little bit
about your model and some plans, that would be great. I’d love to help
another Harvard student in their endeavors since many give up after
graduating grad school (especially those undergrads...). Again, let us know
what your model actually is.

Best regards

On Tue, Jan 28, 2020 at 7:18 PM Kimberly Regan  wrote:

> Hello,
> I have an idea that I pitched and placed 4th at the Harvard Zaentz Early
> Innovation Challenge. I've been implementing the model at my school for 20+
> years., The technology, a learning management system type program, will
> support the model to streamline procedures in classrooms toward effective
> and efficient student learning. I'm trying to find out what I need to do to
> find a developer, what language I use (meaning software specs), and how
> many people/hours would it take to develop it. I have a doctorate in
> education, but a newbie in technology development. A friend recommended I
> post a question to this site. Any ideas out there? 
> Thanks so much!
> Kimberly
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/540e150c-535b-45dd-a56e-345352bba167%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJVmkNmmdv3ztXN5jnKMptfyR6UHXxByZvXC2e5v01A8RZVWrA%40mail.gmail.com.


Re: DjangoEveryDay. My practice website!

2020-01-20 Thread Andrew C.
What is your major? Usually tying in what you know, how you behave, and
importantly how you think contributes to a certain type — or even workflow
or stack — of learning in CS.

On Mon, Jan 20, 2020 at 1:52 AM Jack Lin  wrote:

> I’m not sure what this gonna be in the future. I think I’m just exlpore
> the way.
> I may want to make this reusable for the newbie in the future and make the
> community better.
> Open to any ideas and contribution.
>
>
> 在 2020年1月20日 於 下午2:49:48, Jack Lin (tkic...@gmail.com) 寫下:
>
> Oh yes, this is all on Github. I’ll update the page to include GitHub link
> today! Thanks for reminding.
>
>
> 在 2020年1月20日 於 上午1:43:43, Balaji Shetty (balajishe...@gmail.com) 寫下:
>
> Great
>
> We follow you means ...
>
> Are you making code available on github to improve further..
>
> On Sunday, January 19, 2020, Jack Lin  wrote:
>
>> Hi everyone. I'm doing #DjangoEveryday Challenge to myself.
>> I set a goal for everyday and try to accomplish it. So I got practice and
>> progress everyday :)
>>
>> I'm doing this for preparation of my resume. I'm looking for Django Job
>> in Taiwan but CS is not my major.
>> I want to share this with you guys!
>>
>> btw, I do a bit of develop journal on my Linkedin, too. so if you are
>> interested on my progression, you can follow me on Linkedin!
>>
>> There is the website: Jack's Practice Zone
>> 
>> and this is my Linkedin
>>  :)
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/fc2e047e-d362-4110-b6c5-9853402b0120%40googlegroups.com
>> 
>> .
>>
>
>
> --
> Mr Shetty Balaji
> Asst. Prof.
> IT Department
> SGGS I
> Nanded. My. India
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAECSbOtnvBqGo24hmoA5%2BA56P%2BtZ5VU5OBaSQpHm8VsdRE4sbg%40mail.gmail.com
> 
> .
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAP7OQq0QTXBWSP7WoKahq1ezh2S2hH9Akk96OQQp-XD0pE1pfA%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJVmkN%3DxSRWJ6asFgzkn320Z4Hw30wUCU4D4VdkterLSHVSj%2Bg%40mail.gmail.com.


Re: Correct Design: one app depending on another app

2019-11-20 Thread Andrew C.
I’m not sure what you mean by content management, so I’m gonna take a
guess: website builder like Weebly or Wix. You need a NoSQL database,
completely unstructured data. Kind of like a crime file drawer with folders
dedicated to each case and all its evidence. Some folders only have one
piece of evidence and others a whole lot, right?

By the looks of it, you’re making some revolutionary Weebly or Wix or
whatever with some custom features. If so, here’s what I’d recommend:

1) Read up on how jinja is developed. Jinja is the templating thing we use
in Django, for example: { if user.is_authenticated}
This will help you layout each individual website.

2) Use an unstructured database, like MongoDB or Cassandra. I almost always
tell people you should never have to use a NoSQL db, but in your case, it
might work. Take MongoDB’s document-based schema: each document belongs to
a single website. Within each document would be the site’s content using
keys as a way to input the key’s values on to the website (hopefully that
makes sense) using a jinja inspired template.

The thing I’m confused about is your media app. So I’m gonna guess again
and hopefully you can clear it up for me if need be. If not, still lemme
know.

Let’s say — I’m imagining a website builder like Wix and Weebly right now
btw — that a user drags some music container onto his/her website. The user
adds music and stuff via a different app? I don’t think that’s necessary
unless you code this part in C (for finding the files. Read on for what I
mean).

If you’re not using AWS with cookiecutter-django for deployment, I’d
recommend you go to The Eye (somewhere on Reddit and Discord or their
website) to figure out how to name these uploaded files or make some sort
of system to find these files quickly while keeping them private from other
users (by replacing uploaded file names with extremely long names. That’s
how Dropbox does it I believe).

The Eye is like an Archive team. They’re lovely and helpful people,
especially regarding data hoarding which you’re project might entail in...

I try my best to help completely new Django members with great ideas start
their journey or make that giant leap. So if this shit made no sense, don’t
feel frustrated when you could simply clarify some stuff for me. Good luck!

On Wed, Nov 20, 2019 at 8:42 AM Random Body Parts 
wrote:

> So I want to realise a small content management system. I want to make an
> app that allows for the creation of site content. A site content element
> can be a headline, an image, a block of text, etc... Individual content
> elements will be associated with a content container, which is essentially
> a list. A simple blog article would for instance contain a headline and a
> text block. The site content app will also provide its services for other
> apps. For instance there will be an archive for media files (images, music
> in the form of mp3, videos, etc...). So another content container would be
> a music album. It would be made up of a headline, an image (the cover
> artwork) and a list of music files. Now here it gets a little bit more
> complex. The media files will be handled by yet another app. So the content
> container for a music album would incorporate the headline from the site
> content app, but it would also incorporate the media files from the media
> files app, yet it would be displayed by the archive app.
> The before mentioned apps don't really have a hierarchical relationship.
> My instinct tells me that all the content container elements (blog article,
> music album, image gallery, etc...) should all be living insidethe site
> content app. However the site content app would then depend on all sorts of
> models from other apps. So is this the correct way to go about it? I want
> the site content app to be pluggable by itself. Now for the more complex
> container elements I need external models. So I'm thinking I would do a
> conditional import, kinda like this:
>
> try:
> import jsonexcept ImportError:
> import simplejson as json
>
> So then the more complex container models would only be available if the
> needed apps and their models are present.
> Any advice on this design approach is very welcome.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e479e9bf-0bbd-4197-8930-1f2c65d2689f%40googlegroups.com
> 
> .
>

-- 
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 view this 

Re: Directly Accessing Dictionary Values

2019-11-20 Thread Andrew Stringfield
I have not!  I did see something about that on a website.  Would it go 
something like: dictionary_name.fieldname.0 ?  I will try it out later today.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f1615df3-04bc-4a28-9914-535c51f13268%40googlegroups.com.


Re: Directly Accessing Dictionary Values

2019-11-20 Thread Andrew Stringfield
Okie-dokie.  Thank you.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/83187d02-2f28-4652-8986-83dfcd65108e%40googlegroups.com.


Re: Directly Accessing Dictionary Values

2019-11-20 Thread Andrew Stringfield
First, thank you for the reply Suraj!  I think that I misstated what I was 
really trying to do.  I am trying to access the dictionary values directly 
in the Template and not in the View.  I am trying to remove:

{% for question in unique_key_object %}
   {{ question.filename }}
   {% endfor %}

and just have:
{{ unique_key_object.filename }}




On Tuesday, November 19, 2019 at 10:59:07 PM UTC-5, Suraj Thapa FC wrote:
>
> Return the unique key object... Like
> return render(request, 'abc.html',unique_key)
>
> On Wed, 20 Nov 2019, 9:18 am Andrew Stringfield,  > wrote:
>
>> Hello all,
>>
>>  I am trying to access Dictionary values directly.  Here is my view:
>>
>> def unique_key_query(request, unique_key):
>> unique_key_object = 
>> simpleformmodel.objects.all().filter(id=unique_key)
>> context = {'unique_key_object': unique_key_object}
>> return render(request, "bash_file_page.html", context)
>>
>> Here is my template:
>> {% if unique_key_object %}
>> {% for question in unique_key_object %}
>> {{ question.filename }}
>> {% endfor %}
>> {% else %}
>> No data is available.
>> {% endif %}
>>
>> I can access Dictionary values with a for loop, but I just do not want to 
>> do that.  How can I access the values directly?
>>
>> Thank you.
>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/b8ee9cc4-1d49-4464-b181-583042182576%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/b8ee9cc4-1d49-4464-b181-583042182576%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5dc09b06-1daa-432f-b31d-18a698bb0b4b%40googlegroups.com.


Directly Accessing Dictionary Values

2019-11-19 Thread Andrew Stringfield
Hello all,

 I am trying to access Dictionary values directly.  Here is my view:

def unique_key_query(request, unique_key):
unique_key_object = 
simpleformmodel.objects.all().filter(id=unique_key)
context = {'unique_key_object': unique_key_object}
return render(request, "bash_file_page.html", context)

Here is my template:
{% if unique_key_object %}
{% for question in unique_key_object %}
{{ question.filename }}
{% endfor %}
{% else %}
No data is available.
{% endif %}

I can access Dictionary values with a for loop, but I just do not want to 
do that.  How can I access the values directly?

Thank you.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b8ee9cc4-1d49-4464-b181-583042182576%40googlegroups.com.


Re: Channels 2 using asyncio run_in_executor

2019-10-18 Thread Andrew Godwin
It should be fine, but you will need to be careful - there's a lot of
side-effects with run_in_executor you should be aware of like the way
exceptions propagate (Django won't handle them right for you) and the
possibility of deadlock.

Andrew

On Fri, Oct 18, 2019 at 11:27 AM BR  wrote:

> Should I expect any issues using asyncio run_in_executor to run blocking
> code? I realize there is the sync_to_async function as well, but that
> wasn't working in my case. I'm using multiprocessing.Queue to share data
> with a new process, and when I try to use queue.get() with either
> sync_to_async or run_in_executor, the calling method hangs.
>
> My solution for now was to run a queue.get() listener in a separate
> thread, but it would have been nicer to use await with run_in_executor. Is
> there any custom configuration of the consumer event loop that prevents
> some times of functions from running, even when run with appropriate
> wrapping functions?
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3be88116-f199-483e-9ee9-73d3a292c81d%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/3be88116-f199-483e-9ee9-73d3a292c81d%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFwN1uo%2BC9wS-%2BjEpz9OaUXcS7hO2SauxA9evUUuTiraOS69ww%40mail.gmail.com.


Re: Channels: launching a custom co-routine from SyncConsumer

2019-08-15 Thread Andrew Godwin
SyncConsumer isn't async - it runs inside a separate synchronous thread.
You'll need to get the event loop from the other thread and use
call_soon_threadsafe instead!

Andrew

On Wed, Aug 14, 2019 at 6:59 PM Dan Merillat  wrote:

>
> I have an application that's 99% using the ORM and database work so it is
> using SyncConsumer.
> However, I have one minor part that needs to use a timer, and I cannot get
> it to work for the life of me.
>
> In an AsyncConsumer, I can use asyncio.ensure_future(self.coroutine()) to
> start a timer.
>
> In sync consumer, nothing I've tried works:
>
> class TestConsumer(SyncConsumer):
>
> async def timer_task(self):
> print(f'timer task: {self.counter}')
> asyncio.sleep(1)
> self.counter += 1
> print(f'timer expired: {self.counter}')
>
> def connect(self):
> self.counter = 0
>
> self.timer = asyncio.ensure_future(self.timer_task())
> # ERROR:daphne.server:Exception inside application: There is no
> current event loop in thread 'ThreadPoolExecutor-0_20'.
>
> self.timer =
> async_to_sync(asyncio.ensure_future)(self.timer_task())
> # ERROR:daphne.server:Exception inside application: You cannot use
> AsyncToSync in the same thread as an async event loop - just await the
> async function directly.
>
> I thought SyncConsumer was async under the hood, but I have no idea how to
> leverage that.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6fe7ad95-1bdb-4de2-9ed2-8c566ba27939%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/6fe7ad95-1bdb-4de2-9ed2-8c566ba27939%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFwN1uoGn%2B7C0hLFat%3DjMVgOKL2nYHAuae1i6mrC-JRW6W0uww%40mail.gmail.com.


Re:

2019-08-10 Thread Andrew C.
I suppose in a view, you can write something along these lines:

import json
from os import path
from django.conf import settings

def index(request):
if request.method == ‘POST’:
 form = YourForm(request.POST)
 if form.is_valid():
 field1 = form.cleaned_data.get(‘field1_from_form’)
 # write your JSON here
 # Follow this tutorial to write your json:
https://stackabuse.com/reading-and-writing-json-to-a-file-in-python/
 # Instead of dumping your file into a txt like they did in the
first example, do this:
 with open(path.join(settings.MEDIA_ROOT, “ajsonfile.json”),
“w+”) as outfile:
   json.dump(data, outfile)
  return redirect(request.get_absolute_uri())
elif request.method == “GET”:
form = YourForm()
return render(request, “index.html”, {‘form’: form}


I forgot the import statement for the redirect

On Sat, Aug 10, 2019 at 6:28 AM Suraj Thapa FC 
wrote:

> How do I write my front-end form response in..  .json file
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPjsHcG4%3D%3D%2BRWSeDocSiF9dGaHdt4LFi%2B-AB11Q43vOhZnY1Zg%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJVmkN%3Dep5tSFa01XjfvyZdhhzVSXekcpkC1Wx1U-xR2cjP9ww%40mail.gmail.com.


Re: How to build users tagging system in my comment textarea.

2019-08-10 Thread Andrew C.
You would probably need AJAX calls. I think there’s a package called
Django-autocompletelite which can help you with this. So, in your HTML, you
can use use AJAX to see when a user types the @ character with a single
letter and then show a box with some usernames with that.

On Sat, Aug 10, 2019 at 3:31 AM Ashutosh Kumar  wrote:

> Hi Guys,
>
> I need help in adding user tagging feature in comment textarea, like how
> to get the users list pops out on the keypress "@".
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAcNNf%2BjK%3DK9EopJ_O_Yjf6RXUMzZAWJfN7RJTeBYYpEQ4cVkQ%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJVmkNnH18feOURis6Lq6ohLc0_c%2BgNw5gVD0qzoRWGAWC0QiA%40mail.gmail.com.


Re: Django models and json integration

2019-08-10 Thread Andrew C.
Two options:

1) Save the JSON files and link it with a FileField

2) Use PostgreSQL’s Django-specific JSONField.

On Sat, Aug 10, 2019 at 9:46 AM Suraj Thapa FC 
wrote:

> How can I linked a JSON file with my db... Json files contains the key
> value pair of the user data..
> If the id in the db and the id in the json files matches i can fetch and
> read it..
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPjsHcFbqtWJmDXrbafemf8TQkX9gROW-TxOvirvjsFut%3D5A1w%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJVmkNkTkjYFOvwPO%3DRrdtephow%2BH4rJNk0KQNriWmO%2Bm3hEmw%40mail.gmail.com.


Re: Only for specific region

2019-07-29 Thread Andrew C.
https://pypi.org/project/django-ip-restriction/
Try just searching up “Django ip restrict” or “django ip restriction” or
“django ip block”

There are plenty of options out there. As for why this might be needed, you
can blame China with all these bot attacks on websites :P It can also be
for other reasons.

On Mon, Jul 29, 2019 at 9:07 PM Sebastian Jung 
wrote:

> Hello,
>
> I want that my Website only German user can Open it and another User from
> Others Region a template Show, that they Not live in Germany.
>
> Regards
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3191e21a-4b74-415a-ba1f-8c5dee0ed606%40googlegroups.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJVmkNkQzBXi3nT5L_SCKMcB-5-KdQao5S6vuzziNEoogi%2Bk7w%40mail.gmail.com.


Re: Getting AttributeError: module 'asyncio' has no attribute '_get_running_loop'

2019-07-08 Thread Andrew Godwin
The bug was only on Python 3.5. It's possible the other system was 3.6 or
3.7?

Andrew

On Sun, Jul 7, 2019 at 9:48 AM Rohit Chopra  wrote:

> Hi Andrew,
>
> Just a small doubt, why same code is working on my local system.
> Both local and server have same  version of requirements mentioned in
> requirements.txt
>
> Rohit
>
> On Sun 7 Jul, 2019, 9:36 PM Andrew Godwin,  wrote:
>
>> Hi Rohit,
>>
>> This is my fault - we made a change in the "asgiref" library that
>> inadvertently removed Python 3.5 support. Channels still needs to support
>> it (even though Django doesn't).
>>
>> If you update to asgiref 3.1.4, which I've just released, that should fix
>> the issue.
>>
>> Andrew
>>
>> On Sun, Jul 7, 2019 at 8:52 AM Rohit Chopra 
>> wrote:
>>
>>> Hi All,
>>>
>>> I am using channels to implement WebSockets.
>>> I am trying to send data through WebSockets from *post_save *django
>>> signal.
>>> Below is my code.
>>>
>>> **signals.py**
>>>
>>>
>>> @receiver(post_save, sender=CheckIn)
>>> def send_data_on_save(sender, instance, **kwargs):
>>> channel_layer = get_channel_layer()
>>> stats = get_stats()
>>> async_to_sync(channel_layer.group_send)(
>>> 'dashboard',
>>> {
>>> 'type': 'send_data',
>>> 'message': stats
>>> }
>>> )
>>>
>>>
>>> analytics = get_analytics()
>>> async_to_sync(channel_layer.group_send)(
>>> 'analytic',
>>> {
>>> 'type': 'send_data',
>>> 'message': analytics
>>> }
>>> )
>>>
>>>
>>>
>>> **consumers.py**
>>>
>>>
>>> class DashboardConsumer(WebsocketConsumer):
>>> def connect(self):
>>> self.room_group_name = 'dashboard'
>>>
>>>
>>> # Join room group
>>> async_to_sync(self.channel_layer.group_add)(
>>> self.room_group_name,
>>> self.channel_name
>>> )
>>>
>>>
>>> self.accept()
>>>
>>>
>>> def disconnect(self, close_code):
>>> # Leave room group
>>> async_to_sync(self.channel_layer.group_discard)(
>>> self.room_group_name,
>>> self.channel_name
>>> )
>>>
>>>
>>> # Receive message from WebSocket
>>> def receive(self, text_data):
>>> text_data_json = json.loads(text_data)
>>> message = text_data_json['message']
>>>
>>>
>>> # Send message to room group
>>> async_to_sync(self.channel_layer.group_send)(
>>> self.room_group_name,
>>> {
>>> 'type': 'send_data',
>>> 'message': message
>>> }
>>> )
>>>
>>>
>>> # Receive message from room group
>>> def send_data(self, event):
>>> message = event['message']
>>>
>>>
>>> # Send message to WebSocket
>>> self.send(text_data=json.dumps({
>>> 'message': message
>>> }))
>>>
>>>
>>>
>>> this same piece of code is working on my local machine(windows) but when
>>> i am trying to run this code on server(ubuntu 16.04) i am getting bellow
>>> error:
>>>
>>> **Traceback**
>>>
>>>
>>>
>>> Exception inside application: module 'asyncio' has no attribute
>>> '_get_running_loop'
>>> File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
>>> result = coro.throw(exc)
>>> File
>>> "/home/user1/demowebapps/env/lib/python3.5/site-packages/channels/sessions.py"
>>> , line 183, in __call__
>>> return await self.inner(receive, self.send)
>>> File
>>> "/home/user1/demowebapps/env/lib/python3.5/site-packages/channels/middleware.py"
>>> , line 41, in coroutine_call
>>> await inner_instance(receive, send)
>>> File
>>> "/home/user1/demowebapps/env/lib/python3.5/site-packages/channels/consumer.py"
>>> , line 59, in __call__
>>> [

Re: Getting AttributeError: module 'asyncio' has no attribute '_get_running_loop'

2019-07-07 Thread Andrew Godwin
Hi Rohit,

This is my fault - we made a change in the "asgiref" library that
inadvertently removed Python 3.5 support. Channels still needs to support
it (even though Django doesn't).

If you update to asgiref 3.1.4, which I've just released, that should fix
the issue.

Andrew

On Sun, Jul 7, 2019 at 8:52 AM Rohit Chopra  wrote:

> Hi All,
>
> I am using channels to implement WebSockets.
> I am trying to send data through WebSockets from *post_save *django
> signal.
> Below is my code.
>
> **signals.py**
>
>
> @receiver(post_save, sender=CheckIn)
> def send_data_on_save(sender, instance, **kwargs):
> channel_layer = get_channel_layer()
> stats = get_stats()
> async_to_sync(channel_layer.group_send)(
> 'dashboard',
> {
> 'type': 'send_data',
> 'message': stats
> }
> )
>
>
> analytics = get_analytics()
> async_to_sync(channel_layer.group_send)(
> 'analytic',
> {
> 'type': 'send_data',
> 'message': analytics
> }
> )
>
>
>
> **consumers.py**
>
>
> class DashboardConsumer(WebsocketConsumer):
> def connect(self):
> self.room_group_name = 'dashboard'
>
>
> # Join room group
> async_to_sync(self.channel_layer.group_add)(
> self.room_group_name,
> self.channel_name
> )
>
>
> self.accept()
>
>
> def disconnect(self, close_code):
> # Leave room group
> async_to_sync(self.channel_layer.group_discard)(
> self.room_group_name,
> self.channel_name
> )
>
>
> # Receive message from WebSocket
> def receive(self, text_data):
> text_data_json = json.loads(text_data)
> message = text_data_json['message']
>
>
> # Send message to room group
> async_to_sync(self.channel_layer.group_send)(
> self.room_group_name,
> {
> 'type': 'send_data',
> 'message': message
> }
> )
>
>
> # Receive message from room group
> def send_data(self, event):
> message = event['message']
>
>
> # Send message to WebSocket
> self.send(text_data=json.dumps({
> 'message': message
> }))
>
>
>
> this same piece of code is working on my local machine(windows) but when i
> am trying to run this code on server(ubuntu 16.04) i am getting bellow
> error:
>
> **Traceback**
>
>
>
> Exception inside application: module 'asyncio' has no attribute
> '_get_running_loop'
> File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
> result = coro.throw(exc)
> File
> "/home/user1/demowebapps/env/lib/python3.5/site-packages/channels/sessions.py"
> , line 183, in __call__
> return await self.inner(receive, self.send)
> File
> "/home/user1/demowebapps/env/lib/python3.5/site-packages/channels/middleware.py"
> , line 41, in coroutine_call
> await inner_instance(receive, send)
> File
> "/home/user1/demowebapps/env/lib/python3.5/site-packages/channels/consumer.py"
> , line 59, in __call__
> [receive, self.channel_receive], self.dispatch
> File
> "/home/user1/demowebapps/env/lib/python3.5/site-packages/channels/utils.py"
> , line 52, in await_many_dispatch
> await dispatch(result)
> File
> "/home/user1/demowebapps/env/lib/python3.5/site-packages/asgiref/sync.py",
> line 145, in __call__
> return await asyncio.wait_for(future, timeout=None)
> File "/usr/lib/python3.5/asyncio/tasks.py", line 373, in wait_for
> return (yield from fut)
> File "/usr/lib/python3.5/asyncio/futures.py", line 361, in __iter__
> yield self  # This tells Task to wait for completion.
> File "/usr/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup
> future.result()
> File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
> raise self._exception
> File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in
> run
> result = self.fn(*self.args, **self.kwargs)
> File
> "/home/user1/demowebapps/env/lib/python3.5/site-packages/channels/db.py",
> line 14, in thread_handler
> return super().thread_handler(loop, *args, **kwargs)
> File
> "/home/user1/demowebapps/env/lib/python3.5/site-packages/asgiref/sync.py",
> line 164, in thread_handler
>

Re: Django User model

2019-06-24 Thread Andrew C.
Like a profile? Try this:
https://simpleisbetterthancomplex.com/tutorial/2016/11/23/how-to-add-user-profile-to-django-admin.html

On Mon, Jun 24, 2019 at 9:13 AM AMOUSSOU Kenneth 
wrote:

> Hi everyone,
>
> Is it possible to create different class that will extend the `User` base
> class with different attributes? And use those class for authentication
> Thanks
>
> --
> 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/860ecbae-0492-4f4c-8df3-459b32a46a76%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/CAJVmkNkY6snPQ-occ1fkDLykX2%2BiyOHd17rMEDVMeqx4W%3DKDyg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Internal Ranking System Application

2019-06-24 Thread Andrew C.
Np!

https://docs.djangoproject.com/en/2.2/ref/models/fields/#floatfield

Just refer to the docs. There’s FloatField and DecimalField for models.
When you show the numbers in views, just use python to round the numbers.
There are plenty of tutorials and SO (stackoverflow) questions that’ll
help. People on stack who like Django and want more rep points answer
Django tagged questions, so questions are quickly answered. Like matter of
minutes.

Yea, I think all those details are confusing me, but veerrry logical in
your mind since it’s your project. Here’re some things to keep in mind:

Queries: Use them efficiently. Using that one table, ContestScores, we can
find some scores for specific contests. We can write something like:

from .models import ContestScores

avar= ContestScores.objects.filter(contest=2)
thisvar = ContestScores.objects.filter(user=‘derek’)

Using this, we have a queryset. Any records/rows with contest ID 2 in the
ContestScores table will be in avar. In thisvar, any record that has a user
named derek will be stored.

When making a queryset needs to be ordered by some system (I think it was
descending scores), you can do this using the variables above:
avar.order_by(‘-scores’)

Signals: something I avoided for awhile, but got the hang of pretty
quickly. They have some cool little things like pre_save.

from .signals import my_func
pre_save.connect(my_func, sender=ContestScores)

#in signals.py in the apps directory

def my_func(sender, instance, **kwargs):
if instance.contest == 1:
print(‘hello, you should probably do something with this function’)
else:
 print(‘The contest for this record is Contest 1’)
if sender == ContestID:
print(‘the sender is a table, which in this case was ContestID’)
else:
print(‘hi’)


So, say someone created a new row in ContestScores. What’ll happen is,
before the object is saved in the database, it’ll go through that function
first. So if a user created a row setting the contest to be Contest 1, then
you should see “Hello, you should...” and “hi”

I imagine you could use signals for the Index(overall score. There’s
something in databases called indexes). When showing the ranks of
individuals, that’ll be done per request using the order_by method shown
above.

Regarding the semesters, I’d say just add another column to ContestScores
called semesters, then use the filter(semesters=1, user=derek) or
filter(semesters=1, contest=1).

The Django documentation is amazing, and can answer a lot of questions. I
also said to use Django REST API. You don’t need to use it, but the reason
I suggested it was because of its interface. Much smoother than the regular
Django admin, but does require a little bit more work. Of course in
production, you can disable it. I think of it as a neat debug toolbar.

gl!

On Mon, Jun 24, 2019 at 9:02 PM Derek Dong 
wrote:

> I just wanted to add a question: I want to store the indices as floats if
> possible, to at least 3 decimal places, and display them to the nearest
> integer. Is this possible?
>
>
> On Monday, June 24, 2019 at 8:38:34 PM UTC-4, Derek Dong wrote:
>>
>> Thank you so much for the incredibly in-depth response, it's clarified
>> quite a bit of how Django and databases work! I now realize how much I was
>> overcomplicating things.
>>
>> s/a is a formula: the score of an individual divided by the top-15
>> average.
>> The top-15 average is computed for each contest; as expected, it's the 15
>> highest scores, averaged.
>> Thus, it is very possible and, in fact, very common for multiple people
>> to have the same index for a single contest.
>>
>> Think of the end goal as a cumulative grade for each person.
>> So, say, for the first semester, Contests 1 and 2 could be extremely
>> important and be weighted as 25% of the total grade each, with contests 3-7
>> weighted 10% of the total grade each.
>> Then, in the second semester, Contests 1 and 2 contained material less
>> relevant to what was studied in that time, and are weighted 5% each of the
>> cumulative grade, with contests 3-7 still weighted 10% each and contests 8
>> and 9 weighted 20% each.
>>
>> (Note: These aren't "grades," so don't worry about the ethics here. It's
>> just I think this analogy works quite well to describe the system)
>>
>> I want to be able to query the rankings for the first semester and the
>> second semester. For example, there could be a dropdown menu with the
>> options "Semester 1" and "Semester 2" and if I select, say, the latter, a
>> table will show the data for the second semester (Rank, Student, Grade,
>> Overall Index, and indices for each contest contributing to that overall
>> index). If you could point me in a direction for how to do this as well, I
>> would appreciate it a lot!
>>
>> Thanks again for your care and thoroughness!
>>
>> On Monday, June 24, 2019 at 5:14:19 PM UTC-4, Yoo wrote:
>>>
>>> Gotcha. I’ll try my best to explain what you could try. And if this
>>> looks sloppy, then 

Re: Internal Ranking System Application

2019-06-24 Thread Andrew C.
Gotcha. I’ll try my best to explain what you could try. And if this looks
sloppy, then I’ll make a public gist.

So, firstly, let’s set some things straight. A database is a collection of
tables. Models in Django represent one table with multiple columns. Tables
do not need to have the same columns. What you’ve given is one table and
appending lots of new attributes. That’s a non-relational database that I
advise you stay away from.

Here’s what I have in mind: there is a profile table. All users in this
table are in all contests.

We’re gonna first ignore the Profile model from that link. That’ll be the
thing that houses student’s grade. Django has its OWN Users model which the
Profile table extends from. Again, let’s ignore the Profile, for now. First
import the Django user model:

from django.contrib.auth.models import Users

Then,  based on what I’m imagining,  we’re going to make one table called
ContestID that can include Contest name(optional) and the main behemoth,
ContestScore:

import uuid

class ContestID(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=True)

# You don’t have to have the id field since Django automatically enables it
if another attribute/column isn’t specified as primary key. I just wanted
to show everything

class ContestScores(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4,
editable=False)
contest = models.ForeignKey(ContestID, on_delete=models.CASCADE)
user = models.ForeignKey(User, on_delete=models.SET_NULL)
score = models.PositiveIntegerField(default=0)

Alr, here’s what’s goin’ on. We have multiple contests listed in ContestID.
If they don’t have names, you can delete the names column/line-of-code.

Then in the table ContestScores, we have an id field called UUIDField. In
regular relational databases, row ids are unique. In your spreadsheet, each
record/row was unique by an incrementing row number. For us, this might be
several gazillionbillionakfhwjbxin rows, so we wanna be safe with this
thing called Universally Unique Identifier.

The contest column is a foreign key. This means the that this row belongs
to Contest 1 or Contest 2, etc.

The score column is this user’s score based on a certain contest. The user
column specifies which user this record of scores belongs to.

So in its entirety, the Contest table would “read” like this: in Contest 1,
the user Derek received a score of 94. We can find this record at the id:
ajbi02-kebo... (it’s 32 chars long).

Ok, it looks pretty useless right now.

Now, let’s implement that Profile table:

class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE,
primary_key=True)
grade = models.PositiveSmallIntegerField()
index = models.PositiveIntegerField()

Before I move on, I just need to clarify something: what is the index? Is
it s/a, and is the index unique for each student. Is “a” the average of all
scores across all contests?

The ranking system, if I’m not mistaken, is ranking the players the ENTIRE
TIME. So the number one person should have the highest index, s/a.

I’m clear on what the index is utilized for: ranking. I’m just not so clear
on how the index is calculated.

If you decide you wanna learn this yourself, the best way is to learn what
a relational database is, like MySQL or PostgreSQL or SQLite. Just a small
visual explanation or just seeing a database like those will help you in
the long run.

But if you decide not to learn too much, because sometimes Django becomes a
lot too quickly, just clarify what the index is, and we’ll keep going.

On Mon, Jun 24, 2019 at 3:31 PM Derek Dong 
wrote:

> I'd like to specify my main problem a bit more.
>
> The biggest issue is how to implement the ranking system's calculations
> and input. The way it is currently done is manually on a Spreadsheet, which
> is functional but cumbersome in the event of a slight human error, as well
> as fact that the members change a bit. The way I implemented a Java app to
> deal with it is:
>
> The database is stored in a CSV file, in the form of a spreadsheet, with
> columns labeled: Rank, Name, Grade, Index (Overall score), Contest 1 score,
> Contest 2 score, etc.
>
> To add a new contest's scores:
> For every participating student:
> Enter the student's name
> Enter the student's grade
> Enter the student's score, s
> End for
> Find the top 15 scores' average, a
> For every participating student:
> Compute s/a, find the student in the CSV, and append the result
> For every student not added:
> If the student has a score for that contest already
> Leave it
> Else
> Append 0
> If it's the student's first contest:
> Append a row with the student's name, grade, and 0's for all previous
> contests, completed with that student's index, s/a
> For every student:
> Replace their Index with the average of all their contest scores
> Sort the students by Index in decreasing 

Re: Can we create a Rest Api in Django which can able to communicate with multiple databases(Relational, Non relational) dynamically. If yes please recommend me a way to do that

2019-06-23 Thread Andrew C.
There really isn’t any point in doing that. 1) You should just use one of
the two. Django officially supports Postgres. 2) You’d want to keep your
users all jumbled in one database. If you have a foreign key to the
username field, and the db can’t find a specific user because it’s in the
other db, then what do you do then?

You wouldn’t need a REST api to do whatever your case is. Django supports
using multiple database; just check their doc with a google search. It’s
just a lot more business logic, and in my opinion, a lot more work and
inefficiency.

On Fri, Jun 21, 2019 at 7:25 AM anilkumar sangu 
wrote:

> Hello,
>
> I am working on Django
>
> I have a scenario like
> I want to connect multiple databases. based on user selection.  if user
> selects MySql from front end my Api could able to connect MySql. if user
> select postgreSql my api could able to connect to postgreSql based on user
> selection dynamically. how to achieve this in Django Rest Api
>
> Thanks in advance
>
> --
> 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/50a8fe84-0966-4b2c-bcf4-725f75a78609%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/CAJVmkN%3DW_Mk7L_zRMLZ8xwF5h4%2BPsDQE0jfamPBJS%2Br9mA%3D%2BNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use permissions on a CreateView class?

2019-05-30 Thread Andrew C.
Sorry. Info ISN’T saved on private browser

On Thu, May 30, 2019 at 7:25 PM Andrew C.  wrote:

> Try clearing your browser history and info. Should also test in Incognito
> or Private browser so info is saved. I have a suspicion that your browser
> is saving login info and you’re just not realizing this.
>
> On Tue, May 28, 2019 at 5:54 PM Fellipe Henrique 
> wrote:
>
>> Hi Jim,
>>
>> Tried that, as you can see on my code, but not working.. when user type
>> the url, still see the template..
>>
>> Any suggestions?
>>
>> Regards,
>>
>> T.·.F.·.A.·. S+F
>> *Fellipe Henrique P. Soares*
>>
>> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
>> 's/(.)/chr(ord($1)-2*3)/ge'
>> *Fedora Ambassador: https://fedoraproject.org/wiki/User:Fellipeh
>> <https://fedoraproject.org/wiki/User:Fellipeh>*
>> *Blog: *http:www.fellipeh.eti.br
>> *GitHub: https://github.com/fellipeh <https://github.com/fellipeh>*
>> *Twitter: @fh_bash*
>>
>>
>> On Tue, May 28, 2019 at 2:36 PM Jim Illback 
>> wrote:
>>
>>> I think you can also add to your class (right under your *template_name*…
>>> for example) this statement:
>>>
>>> permission_required = *‘*appname.permission_name'
>>>
>>> This will limit to logged on users (as below), and also to users who 
>>> possess this permission.
>>>
>>> Jim
>>>
>>>
>>> On May 28, 2019, at 9:55 AM, Joe Reitman  wrote:
>>>
>>> Fellipe,
>>>
>>> Here is an example of decorating class based views from the
>>> documentation
>>> <https://docs.djangoproject.com/en/2.2/topics/class-based-views/intro/#decorating-class-based-views>
>>> :
>>>
>>> from django.contrib.auth.decorators import login_requiredfrom 
>>> django.utils.decorators import method_decoratorfrom django.views.generic 
>>> import TemplateView
>>> class ProtectedView(TemplateView):
>>> template_name = 'secret.html'
>>>
>>> @method_decorator(login_required)
>>> def dispatch(self, *args, **kwargs):
>>> return super().dispatch(*args, **kwargs)
>>>
>>>
>>> On Tuesday, May 28, 2019 at 6:54:38 AM UTC-5, Fellipe Henrique wrote:
>>>>
>>>> Hello,
>>>>
>>>> I have these class, based on CreateView class... and I only want allow
>>>> user with these permissions to add record...
>>>>
>>>> class ClienteCreateView(ERPbrViewMixin, CreateView):
>>>> template_name = 'cadastro/cliente/form.html'
>>>> permission_required = ('cliente.can_open', 'cliente.can_edit', 
>>>> 'cliente.can_add')
>>>> model = Cliente
>>>> form_class = ClienteForm
>>>>
>>>> But, not working... user without these permission, when type the url
>>>> show the form...
>>>>
>>>> Any tips how to do that?
>>>>
>>>> Cheers!
>>>>
>>>>
>>>> T.·.F.·.A.·. S+F
>>>> *Fellipe Henrique P. Soares*
>>>>
>>>> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
>>>> 's/(.)/chr(ord($1)-2*3)/ge'
>>>> *Fedora Ambassador: https://fedoraproject.org/wiki/User:Fellipeh
>>>> <https://fedoraproject.org/wiki/User:Fellipeh>*
>>>> *Blog: *http:www.fellipeh.eti.br <http://www.fellipeh.eti.br/>
>>>> *GitHub: https://github.com/fellipeh <https://github.com/fellipeh>*
>>>> *Twitter: @fh_bash*
>>>>
>>>
>>> --
>>> 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/060a2c59-bf39-456c-a686-bf6ba104e1f7%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/060a2c59-bf39-456c-a686-bf6ba104e1f7%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups 

Re: How to use permissions on a CreateView class?

2019-05-30 Thread Andrew C.
Try clearing your browser history and info. Should also test in Incognito
or Private browser so info is saved. I have a suspicion that your browser
is saving login info and you’re just not realizing this.

On Tue, May 28, 2019 at 5:54 PM Fellipe Henrique  wrote:

> Hi Jim,
>
> Tried that, as you can see on my code, but not working.. when user type
> the url, still see the template..
>
> Any suggestions?
>
> Regards,
>
> T.·.F.·.A.·. S+F
> *Fellipe Henrique P. Soares*
>
> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
> 's/(.)/chr(ord($1)-2*3)/ge'
> *Fedora Ambassador: https://fedoraproject.org/wiki/User:Fellipeh
> *
> *Blog: *http:www.fellipeh.eti.br
> *GitHub: https://github.com/fellipeh *
> *Twitter: @fh_bash*
>
>
> On Tue, May 28, 2019 at 2:36 PM Jim Illback  wrote:
>
>> I think you can also add to your class (right under your *template_name*…
>> for example) this statement:
>>
>>  permission_required = *‘*appname.permission_name'
>>
>> This will limit to logged on users (as below), and also to users who possess 
>> this permission.
>>
>> Jim
>>
>>
>> On May 28, 2019, at 9:55 AM, Joe Reitman  wrote:
>>
>> Fellipe,
>>
>> Here is an example of decorating class based views from the documentation
>> 
>> :
>>
>> from django.contrib.auth.decorators import login_requiredfrom 
>> django.utils.decorators import method_decoratorfrom django.views.generic 
>> import TemplateView
>> class ProtectedView(TemplateView):
>> template_name = 'secret.html'
>>
>> @method_decorator(login_required)
>> def dispatch(self, *args, **kwargs):
>> return super().dispatch(*args, **kwargs)
>>
>>
>> On Tuesday, May 28, 2019 at 6:54:38 AM UTC-5, Fellipe Henrique wrote:
>>>
>>> Hello,
>>>
>>> I have these class, based on CreateView class... and I only want allow
>>> user with these permissions to add record...
>>>
>>> class ClienteCreateView(ERPbrViewMixin, CreateView):
>>> template_name = 'cadastro/cliente/form.html'
>>> permission_required = ('cliente.can_open', 'cliente.can_edit', 
>>> 'cliente.can_add')
>>> model = Cliente
>>> form_class = ClienteForm
>>>
>>> But, not working... user without these permission, when type the url
>>> show the form...
>>>
>>> Any tips how to do that?
>>>
>>> Cheers!
>>>
>>>
>>> T.·.F.·.A.·. S+F
>>> *Fellipe Henrique P. Soares*
>>>
>>> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
>>> 's/(.)/chr(ord($1)-2*3)/ge'
>>> *Fedora Ambassador: https://fedoraproject.org/wiki/User:Fellipeh
>>> *
>>> *Blog: *http:www.fellipeh.eti.br 
>>> *GitHub: https://github.com/fellipeh *
>>> *Twitter: @fh_bash*
>>>
>>
>> --
>> 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/060a2c59-bf39-456c-a686-bf6ba104e1f7%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/B5E64E45-C1C3-455F-AEC7-167852FE17C7%40hotmail.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/CAF1jwZHCR%3Dn2FMcdPdWsAOKG7wQRhqKBb4is58P61dGCi8_Eqg%40mail.gmail.com
> 

Re: deploy to Heroku " collectstatic --noinput "

2019-05-27 Thread Andrew C.
Follow a tutorial.
1) Hide your secret key and everything secretive in an environment
variable. Or use Django-environ
2) Try python manage.py check —deploy
3) Debug is set to True... it should not be True if you’re publishing
(deploying)

On Mon, May 27, 2019 at 3:46 PM omar ahmed  wrote:

> i can't publish my project
>
>
> On Monday, May 27, 2019 at 8:45:59 PM UTC+2, Jamiu Olashile Salimon wrote:
>>
>> Hello Omar, what’s the problem?
>>
>> On Sun, 26 May 2019 at 10:35 PM, omar ahmed  wrote:
>>
> git push heroku master
>>> Counting objects: 4, done.
>>> Delta compression using up to 4 threads.
>>> Compressing objects: 100% (4/4), done.
>>> Writing objects: 100% (4/4), 414 bytes | 0 bytes/s, done.
>>> Total 4 (delta 3), reused 0 (delta 0)
>>> remote: Compressing source files... done.
>>> remote: Building source:
>>> remote:
>>> remote: -> Python app detected
>>> remote: -> Installing requirements with pip
>>> remote:
>>> remote: -> $ *python manage.py collectstatic --noinput*
>>> remote:122 static files copied to
>>> '/tmp/build_ae5c33e3156cddd5969268ac72b87668/staticfiles', 392
>>> post-processed.
>>> remote:
>>> remote: -> Discovering process types
>>> remote:Procfile declares types -> web
>>> remote:
>>> remote: -> Compressing...
>>> remote:Done: 55.3M
>>> remote: -> Launching...
>>> remote:Released v12
>>> remote:https://arena3.herokuapp.com/ deployed to Heroku
>>> remote:
>>> remote: Verifying deploy... done.
>>> To https://git.heroku.com/arena3.git
>>>48d580d..0dcd3ad  master -> master
>>>
>>> settings.py
>>>
>>> """
>>> Django settings for arena project.
>>>
>>> Generated by 'django-admin startproject' using Django 2.2.1.
>>>
>>> For more information on this file, see
>>> https://docs.djangoproject.com/en/2.2/topics/settings/
>>>
>>> For the full list of settings and their values, see
>>> https://docs.djangoproject.com/en/2.2/ref/settings/
>>> """
>>>
>>> import os
>>> import django_heroku
>>> import dj_database_url
>>> # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
>>> BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>>>
>>>
>>> # Quick-start development settings - unsuitable for production
>>> # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
>>>
>>> # SECURITY WARNING: keep the secret key used in production secret!
>>> SECRET_KEY = '=l$6@=a%bu(--=pgd)-i!(%-ik&%7k11l_7*3j11eln'
>>>
>>> # SECURITY WARNING: don't run with debug turned on in production!
>>> DEBUG = True
>>>
>>> ALLOWED_HOSTS = []
>>>
>>>
>>> # Application definition
>>>
>>> INSTALLED_APPS = [
>>> 'core.apps.CoreConfig',
>>> 'django.contrib.admin',
>>> 'django.contrib.auth',
>>> 'django.contrib.contenttypes',
>>> 'django.contrib.sessions',
>>> 'django.contrib.messages',
>>> 'django.contrib.staticfiles',
>>> 'django_social_share',
>>> ]
>>>
>>> MIDDLEWARE = [
>>> 'django.middleware.security.SecurityMiddleware',
>>> 'whitenoise.middleware.WhiteNoiseMiddleware',
>>> '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',
>>> ]
>>>
>>> ROOT_URLCONF = 'arena.urls'
>>>
>>> TEMPLATES = [
>>> {
>>> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
>>> 'DIRS': [os.path.join(BASE_DIR,'templates')],
>>> 'APP_DIRS': True,
>>> 'OPTIONS': {
>>> 'context_processors': [
>>> 'django.template.context_processors.debug',
>>> 'django.template.context_processors.request',
>>> 'django.contrib.auth.context_processors.auth',
>>> 'django.contrib.messages.context_processors.messages',
>>> 'core.context_processors.add_to_base',
>>> ],
>>> },
>>> },
>>> ]
>>>
>>> WSGI_APPLICATION = 'arena.wsgi.application'
>>>
>>>
>>> # Database
>>> # https://docs.djangoproject.com/en/2.2/ref/settings/#databases
>>>
>>> DATABASES = {
>>> 'default': {
>>> 'ENGINE': 'django.db.backends.postgresql_psycopg2',
>>> 'NAME': 'arenadb',
>>>  'USER': 'arenaomar',
>>>  'PASSWORD': '',
>>>  'HOST': 'localhost',
>>>  'PORT': '',
>>> }
>>> }
>>>
>>>
>>> # Password validation
>>> #
>>> https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
>>>
>>> AUTH_PASSWORD_VALIDATORS = [
>>> {
>>> 'NAME':
>>> 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'
>>> ,
>>> },
>>> {
>>> 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator'
>>> ,
>>> },
>>> {
>>> 'NAME':
>>> 'django.contrib.auth.password_validation.CommonPasswordValidator',
>>> },
>>> {
>>> 'NAME':
>>> 'django.contrib.auth.password_validation.NumericPasswordValidator',
>>> },
>>> ]
>>>
>>>
>>> # Internationalization
>>> # https://docs.djangoproject.com/en/2.2/topics/i18n/
>>>
>>> LANGUAGE_CODE = 'en-us'
>>>
>>> TIME_ZONE = 'UTC'
>>>
>>> 

Re: AutoField

2019-05-26 Thread Andrew C.
Probably because you have two AutoFields. You can’t have two in the same
model. Set this to eid=models.AutoField(primary_key=True)

This is because Django models automatically makes an id autofield primary
key if nothing else is set as pk.

On Sun, May 26, 2019 at 9:05 PM Bob Gailer  wrote:

> On May 26, 2019 8:16 PM, "Saeed Pooladzadeh"  wrote:
> >
> >
> > Hi
> >
> > When I add this line in my model:
> >
> > eid=models.AutoField()
> >
> > I see error in my migration!!
> >
> > What is the problem?
> >
> > I don't know what your problem is but our problem is that we have no
> idea what error you got. Please copy and paste the entire error message
> into your reply and also reply all so that everyone gets to read your
> response stop
>
> --
> 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/CAP1rxO7ROcWYL9LYO4XMt8_gHmgd74gMJ%3D0yo2pjdegkNekZfQ%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/CAJVmkNm2OS-G0x8X8Vzv42qA5nua6mW_j6rR8hE10%2BCcrrtjxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Run Daphne as non-root on low ports

2019-05-02 Thread Andrew Godwin
In this case "reference server" merely refers to it being the place where
new features and specs are implemented and tested first, rather than being
the best production-capable one. I would say uvicorn is probably the best
ASGI server out there right now for performance.

Andrew

On Thu, 2 May 2019, 06:59 BR,  wrote:

> Thanks for the feedback. I guess I was thinking that since Daphne is the
> "reference server" for ASGI, that it would have features available for
> production type use. I only came across WebSocket stuff yesterday so this
> is all quite new. I suppose my remaining issue is that SSL certificates
> seem to only (usually) accessible by root, so in any situation it seems
> that Daphne can only terminate SSL when running in root, unless permissions
> on the private key are changed.
>
> I'm looking into the nginx reverse proxy with SSL termination at the
> moment.
>
> On Thursday, May 2, 2019 at 9:49:41 AM UTC-4, Andrew Godwin wrote:
>>
>> Daphne does not have uid-changing built in, no - it's too simplistic for
>> that, unfortunately.
>>
>> It's worth noting that systemd has this ability built in - it will listen
>> on sockets for you and bind the socket to an application as needed.
>> Otherwise, as the other poster noted, you can also use a reverse proxy to
>> terminate SSL, which is what Daphne is built assuming (the SSL support in
>> there is because it comes for free with Twisted, rather than being
>> specifically added).
>>
>> 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+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/c3a5b984-d625-4fc4-a792-22d48cb4d3a8%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/c3a5b984-d625-4fc4-a792-22d48cb4d3a8%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1uqghNHtxUA1jGxFrOqtMfPyF_NqCFzgWac6BkXXj1U0VA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Run Daphne as non-root on low ports

2019-05-02 Thread Andrew Godwin
Daphne does not have uid-changing built in, no - it's too simplistic for
that, unfortunately.

It's worth noting that systemd has this ability built in - it will listen
on sockets for you and bind the socket to an application as needed.
Otherwise, as the other poster noted, you can also use a reverse proxy to
terminate SSL, which is what Daphne is built assuming (the SSL support in
there is because it comes for free with Twisted, rather than being
specifically added).

Andrew

On Thu, May 2, 2019 at 6:32 AM BR  wrote:

> I'm running a simple Django/Channels website using Daphne. Traffic will be
> relatively low and will likely only see 1-2 clients at a time. I figured
> this would be a good use case for Daphne to serve both HTTPS and WebSockets.
>
> Does Daphne have a mechanism for starting as root and dropping down to a
> non-root user after it is running? Root is required at startup because I
> want it to bind to port 80 or 443, and it needs to access the SSL
> certificate.
>
> --
> 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/1015c96c-1a20-4372-9de3-3ca6d2347d98%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/1015c96c-1a20-4372-9de3-3ca6d2347d98%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1upBPizH8%2BSQdC9-qt-Z2SXgjtMqquKcMx5PJhswq2k8fg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-01-14 Thread Andrew Godwin
You'll have to design your own consumption architecture if you want to
reliably handle 100 messages a second - since it's UDP, channels won't be
handling it natively so you'll need to terminate and process the UDP
yourself. I'd recommend either getting a UDP loadbalancer if you have
messages coming in from multiple sources, or do your own work queue if it's
a single source and you can't process them fast enough.

Andrew

On Mon, Jan 14, 2019 at 7:31 AM Sahil Mangotra <
sahil.mango...@utradesolutions.com> wrote:

> I am facing a problem in my django web server.
>
> We are using python3, django2, django-rest-framework3.8 and channels2.x
>
> Scenario is we are receiving DATA from a UDP connection at very fast rate
> (~100 messages per second). The data revived is in proto format (you can
> say we are receiving byte data). some data gets starved in this process as 
> *Rate
> of production >>> rate of consumption* we are implementing throttling but
> still at 100 concurrent users data starves again. Can anyone help us in
> this scenario.
>
> If anyone has any new architecture idea please share.
>
> *This is surely an interesting problem. This is about stock market feed*
>
> PS :- I cannot post any code as it is my companies. but i can help any
> time you need clarification on any point.
>
> --
> 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/02c1735d-dc05-44b3-b0a0-d343aa59f8ef%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/02c1735d-dc05-44b3-b0a0-d343aa59f8ef%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1uqFZ%3DKe4yyPdG8-LTGRYLHYegotao9JbQNWOVWLJLoPcA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: channels and https

2018-12-28 Thread Andrew Godwin
You should use an ASGI server (uvicorn/daphne) with an SSL-terminating
server (e.g. nginx) in front of it and proxying to it. Django-sslserver is
a WSGI-based server and so can't support WebSockets.

Andrew

On Tue, Dec 25, 2018 at 4:44 PM  wrote:

> How can I  use channels with https at development
> I try to use django-sslserver but that doesn't work
>
> --
> 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/1ecb3edd-3637-476d-8a61-5ac869f89daa%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/1ecb3edd-3637-476d-8a61-5ac869f89daa%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1uqNWpnYop%3D%2BUL%2B86b1gUgUVzP0aiZ8LtqLoDu_YBB0BGQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django channels communication not asynchronous

2018-12-28 Thread Andrew Godwin
Channels request/response cycles must be natively non-blocking all the way
from the application code up through the server. If you even so much as
slightly block you're going to disrupt everything and maybe deadlock it,
which is why you need to be careful about when you call synchronous things.

If you don't want to deal with all of this, use the SyncConsumer variants
of everything and/or normal django views which will safely run stuff in
threads for you.

Andrew

On Mon, Dec 24, 2018 at 7:24 PM Akshay Surya  wrote:

> Sorry for that Actually in my code I did use await before send, but
> somehow got deleted when I posted here... I would try debugging it but I am
> having a doubt that it's because django is inherently event driven... Is
> there something like a request response cycle should be synchronous that
> you can't send responses in batches? Should I try to do it like conduct the
> execution in threads and the results being pushed to channel layer in the
> background and using django signals to trigger a call whenever something is
> pushed to the channel and send it to a websocket connection... But wouldn't
> that require two websocket connections? One for requesting and another for
> receiving responses Or am I going about it the wrong way
>
> On Monday, December 24, 2018 at 8:36:24 PM UTC+5:30, Andrew Godwin wrote:
>>
>> You appear to have missed an "await" before "self.send" - could that be
>> the cause?
>>
>> In general, the best thing to do if things seem to "block" is to set the
>> environment variable PYTHONASYNCIODEBUG=1 and Python will warn you if
>> anything blocks for too long and seems synchronous.
>>
>> Andrew
>>
>> On Mon, Dec 24, 2018 at 2:24 PM Akshay Surya  wrote:
>>
>>>
>>>
>>> Hi everybody,
>>>
>>> I wrote django channels code to send api data from two different sources
>>> asynchronously through webscokets. The different sources takes few seconds
>>> to 1 minute to compute and send back the data. I managed to call them
>>> asynchronously using asyncio event loop. But the issue is that they are not
>>> sending the response back asynchronously. The code just waits for the all
>>> the data to arrive and sends everything at the same time.
>>>
>>> Channels Code:
>>>
>>> class SearchHotelConsumer(AsyncWebsocketConsumer):
>>> def __init__(self, *args, **kwargs):
>>> super().__init__(*args, **kwargs)
>>> self.source1 = Source1()
>>> self.source2 = Source2()
>>>
>>> async def connect(self):
>>> await self.accept()
>>>
>>> def disconnect(self, close_code):
>>> pass
>>>
>>> async def _source1_handler(self, request, queue):
>>> source1_response = await self.source1.async_post(request)
>>>
>>> await queue.put(source1_response.data)
>>>
>>> async def _source2_handler(self, request, queue):
>>> source2_response = await self.source2.async_post(request)
>>>
>>> await queue.put(source2_response.data)
>>>
>>> async def _send_msg(self, queue):
>>> while True:
>>> message = await queue.get()
>>> if message is None:
>>> break
>>> print('got the message')
>>> self.send(text_data=json.dumps({
>>> 'message': message
>>> }, cls=DjangoJSONEncoder))
>>>
>>> queue.task_done()
>>>
>>> def receive(self, text_data):
>>> text_data_json = json.loads(text_data)
>>> message = text_data_json['message']
>>>
>>> request = HttpRequest()
>>> request.method = 'POST'
>>> request.session = self.scope["session"]
>>> request = Request(request)
>>> for key, val in message.items():
>>> request.data[key] = val
>>>
>>> queue = asyncio.Queue()
>>> sender = asyncio.ensure_future(self._send_msg(queue))
>>>
>>> await self._source1_handler(request, queue)
>>> await self._source2_handler(request, queue)
>>>
>>> await queue.join()
>>>
>>> sender.cancel()
>>>
>>> How can I make the message sending part truly asynchronous?
>>>
>>> Regards
>>>
>>> --
>>> You received this message because you are subscrib

Re: Django channels communication not asynchronous

2018-12-24 Thread Andrew Godwin
You appear to have missed an "await" before "self.send" - could that be the
cause?

In general, the best thing to do if things seem to "block" is to set the
environment variable PYTHONASYNCIODEBUG=1 and Python will warn you if
anything blocks for too long and seems synchronous.

Andrew

On Mon, Dec 24, 2018 at 2:24 PM Akshay Surya  wrote:

>
>
> Hi everybody,
>
> I wrote django channels code to send api data from two different sources
> asynchronously through webscokets. The different sources takes few seconds
> to 1 minute to compute and send back the data. I managed to call them
> asynchronously using asyncio event loop. But the issue is that they are not
> sending the response back asynchronously. The code just waits for the all
> the data to arrive and sends everything at the same time.
>
> Channels Code:
>
> class SearchHotelConsumer(AsyncWebsocketConsumer):
> def __init__(self, *args, **kwargs):
> super().__init__(*args, **kwargs)
> self.source1 = Source1()
> self.source2 = Source2()
>
> async def connect(self):
> await self.accept()
>
> def disconnect(self, close_code):
> pass
>
> async def _source1_handler(self, request, queue):
> source1_response = await self.source1.async_post(request)
>
> await queue.put(source1_response.data)
>
> async def _source2_handler(self, request, queue):
> source2_response = await self.source2.async_post(request)
>
> await queue.put(source2_response.data)
>
> async def _send_msg(self, queue):
> while True:
> message = await queue.get()
> if message is None:
> break
> print('got the message')
> self.send(text_data=json.dumps({
> 'message': message
> }, cls=DjangoJSONEncoder))
>
> queue.task_done()
>
> def receive(self, text_data):
> text_data_json = json.loads(text_data)
> message = text_data_json['message']
>
> request = HttpRequest()
> request.method = 'POST'
> request.session = self.scope["session"]
> request = Request(request)
> for key, val in message.items():
> request.data[key] = val
>
> queue = asyncio.Queue()
> sender = asyncio.ensure_future(self._send_msg(queue))
>
> await self._source1_handler(request, queue)
> await self._source2_handler(request, queue)
>
> await queue.join()
>
> sender.cancel()
>
> How can I make the message sending part truly asynchronous?
>
> Regards
>
> --
> 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/CAJXf11o_B7W3BiCpjKGEgEVynG2o5HoDRxY_EUFuJ%2B5Wbk5Yag%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJXf11o_B7W3BiCpjKGEgEVynG2o5HoDRxY_EUFuJ%2B5Wbk5Yag%40mail.gmail.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1ur1_f2FvCaK%3DwjLgZU1zcmbzXT7c8Qn%2Bvm-mPcWOUV1mg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error when installing channels

2018-12-24 Thread Andrew Godwin
This is a general problem with installing compiled Python packages on
Windows. You'll need to install the compiler as outlined here:
https://wiki.python.org/moin/WindowsCompilers (or search for "python visual
c++ 14")

Andrew

On Sat, Dec 22, 2018 at 11:23 AM shiva kumar 
wrote:

> Hai guys, I am getting error when installing channels using pip.
>
> These is the error ' need Microsoft visual c++ 14.0'
>
> Can anyone suggest how to download and get it done. I tried to do it. I am
> unable to understand how to do and what to do.
>
> Pls respond to my issue.
>
> --
> 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/CAMsYeuHZvppFvWhgdfN8Xrn-abgMM368-Bq28wjw1nDXinsagQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMsYeuHZvppFvWhgdfN8Xrn-abgMM368-Bq28wjw1nDXinsagQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1ur-QuNqD3aTHYLq0yt3nsdCdzt1DWm2UkrYyBwp4d7YXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error of channels

2018-12-17 Thread Andrew Godwin
I've seen a lot of people have a similar error but I'm never sure what
causes it - that said, I generally advise them to check their Redis logs to
see if Redis is OK, as that could cause this?

Andrew

On Mon, Dec 17, 2018 at 11:36 AM  wrote:

> I had an error while build a chatroom useing django-channels:
>
> I tried follow the official website: https://channels.readthedocs.io
>
> but while i build a room to chat with many people, an error occered:
>
> Exception inside application: Reader at end of file
>   File
> "/home/lujianxin/VirtualEnvs/demo/lib/python3.7/site-packages/channels/sessions.py",
> line 179, in __call__
> return await self.inner(receive, self.send)
>   File
> "/home/lujianxin/VirtualEnvs/demo/lib/python3.7/site-packages/channels/middleware.py",
> line 41, in coroutine_call
> await inner_instance(receive, send)
>   File
> "/home/lujianxin/VirtualEnvs/demo/lib/python3.7/site-packages/channels/consumer.py",
> line 59, in __call__
> [receive, self.channel_receive], self.dispatch
>   File
> "/home/lujianxin/VirtualEnvs/demo/lib/python3.7/site-packages/channels/utils.py",
> line 52, in await_many_dispatch
> await dispatch(result)
>   File
> "/home/lujianxin/VirtualEnvs/demo/lib/python3.7/site-packages/channels/consumer.py",
> line 73, in dispatch
> await handler(message)
>   File
> "/home/lujianxin/VirtualEnvs/demo/lib/python3.7/site-packages/channels/generic/websocket.py",
> line 196, in websocket_receive
> await self.receive(text_data=message["text"])
>   File "/home/lujianxin/Files/PycharmProjects/demo/chat/consumers.py",
> line 44, in receive
> 'message': message
>   File
> "/home/lujianxin/VirtualEnvs/demo/lib/python3.7/site-packages/channels_redis/core.py",
> line 611, in group_send
> key, min=0, max=int(time.time()) - self.group_expiry
>   File
> "/home/lujianxin/VirtualEnvs/demo/lib/python3.7/site-packages/aioredis/commands/sorted_set.py",
> line 268, in zremrangebyscore
> return self.execute(b'ZREMRANGEBYSCORE', key, min, max)
>   File
> "/home/lujianxin/VirtualEnvs/demo/lib/python3.7/site-packages/aioredis/commands/__init__.py",
> line 51, in execute
> return self._pool_or_conn.execute(command, *args, **kwargs)
>   File
> "/home/lujianxin/VirtualEnvs/demo/lib/python3.7/site-packages/aioredis/connection.py",
> line 319, in execute
> raise ConnectionClosedError(msg)
>   Reader at end of file
> WebSocket DISCONNECT /ws/chat/ljx/ [192.168.2.126:41154]
>
> if i just build a echo server for one connection, it works ok, but while i
> use channels and group_send, it worked ok when i send one or two message,
> all of memeber of the room received message, while i send more the problem
> raising, i promissed that i followed the lesson and my settings,
> environment is ok, but what caused this error?
>
> --
> 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/210770a5-b587-486d-840c-56e3deab160a%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/210770a5-b587-486d-840c-56e3deab160a%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1urnOyULa1o0GBEqfoRT_8YnUPR3y6umwuiL8goNS80u7w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels: development issue with multiple daphne workers

2018-11-27 Thread Andrew Godwin
I'm not sure why you're getting the  _UnixSelectorEventLoop - that sounds
like a Twisted error you should search around for, and make sure you have
the right package versions.

--fd 0 should not be needed in that command line, since you're already
passing the UNIX socket, I don't remember why it's there.

I suggest you remove fd=0 and see if that then works with multiple
processes.

Andrew

On Mon, Nov 26, 2018 at 3:10 PM Zhiyu (Drew) Li  wrote:

> Hi there,
>
> I am trying to migrate a tornado project to django channel2. I have moved
> all essential parts and wired them up in channel. It runs OK in development
> mode, but in production it seems the multi-daphne worker configuration is
> causing strange errors.
> AttributeError: '_UnixSelectorEventLoop' object has no attribute
> 'remove_timeout'
>
> I followed instructions on the official doc (
> https://channels.readthedocs.io/en/latest/deploying.html) to set up
> supervisor and nginx. But I am still lack of understanding how it works.
> Cloud you please explain more on the following settings?
>
>
> *# TCP socket used by Nginx backend upstream*
> *socket=tcp://localhost:8000*
>
> *# Each process needs to have a separate socket file, so we use
> process_num*
> *# Make sure to update "mysite.asgi" to match your project name*
> *command=daphne -u /run/daphne/daphne%(process_num)d.sock --fd 0
> --access-log - --proxy-headers mysite.asgi:application*
>
> *# Number of processes to startup, roughly the number of CPUs you have*
> *numprocs=4*
>
> *Questions:*
> What is "--fd 0" here? Is "0" the file descriptor for socket
> "tcp://localhost:8000" that Nginx is proxying to?
> What is "-u /run/daphne/daphne%(process_num)d.sock" then? Why do we need
> to set up separate socket for each daphne process? Are all the daphne
> processes already talking to "fd 0"?
>
> My website only works if I change either of the following
> A) change to numprocs=1 ;
> Or
> B) remove "-u /run/daphne/daphne%(process_num)d.sock"
>
> Thanks
> Drew
>
>
> --
> 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/CAMmsbU%3D-oPX_yZ7Kx8PmVfjwKJNSSC0hKOEUXyRGztzHogKGzA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMmsbU%3D-oPX_yZ7Kx8PmVfjwKJNSSC0hKOEUXyRGztzHogKGzA%40mail.gmail.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1uq88vgWuJDuyrc7o7tEdu1OT%2BU-i6yXZ2JuCEUD2%3DXeiw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: difference between class based view and function based view

2018-11-21 Thread Andrew Pinkham
Django developers talk about three kinds of views:

- function views (FV)
- class-based views (CBV)
- generic class-based views (GCBV)

People do not make always make the difference between CBV and GCBV, which is 
unfortunate, as they serve different purposes (naming things is hard). When 
Andréas states earlier in this thread that "(CBV) use a lot of defaults for 
populating your templates, forms and views" that is not 100% precise. He means 
GCBV---which provide default (generic) behavior---not CBV.

Let's break it down. Below is an example of a FV.

from django.http import HttpResponse
from django.views.decorators.http import (
require_http_methods
)

# below is equivalent to require_safe decorator
@require_http_methods(["GET", "HEAD"])
def hello_world(request):
"""Demonstrate HTTP Request/Response"""
return HttpResponse("Hello World")

Below is an example of an equivalent CBV.
 
from django.http import HttpResponse
from django.views import View
 
   class HelloWorld(View):
 """Demonstrate HTTP Request/Response"""

def get(self, request):
"""Handle GET HTTP method"""
return HttpResponse("Hello World")

Formally, a CBV is any class that inherits from View. The only difference 
between the two views above is that the View class being inherited will give 
you automatic handling of HTTP OPTIONS.

Stated otherwise: FV and CBV are *equivalent* with the exception of automatic 
OPTIONS handling in CBV.

GCBV are simply CBV that have been given behavior. For example, instead of 
programming a view that shows a template with model data, you can instead 
inherit a DetailView, and customize it by setting class variables and by 
overriding methods. For more about that, I recommend looking at 
https://ccbv.co.uk .

So, when should you use a FV, CBV, or GCBV?

If you are building a view that a GCBV provides behavior for, save yourself 
time and use it! It's easy to add or slightly modify GCBV behavior, but 
difficult to remove behavior. The moment you're thinking about removing 
something a GCBV does, stick to a function or CBV.

So then, for choosing between FV or CBV: Do you need to handle multiple HTTP 
methods? Is there shared behavior between how the resource is handled by those 
HTTP methods? If yes, a CBV can help organize that logic and avoid duplicate 
code.

However, if you have a simple view (typically only one or two HTTP methods must 
be handled), then a FV will serve you fine (remember the view decorators!).

If you're not sure, start with a FV, and then switch to a CBV or GCBV if 
appropriate (as complexity goes up or when you realize you can use a GCBV).

Hope that helps,
Andrew
https://jambonsw.com
https://django-unleashed.com

-- 
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/C2853144-5CA1-4FAD-ACDF-C487AE8CE47E%40andrewsforge.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django with Channels 2.1.1 Error During WebSocket handshake 404

2018-11-16 Thread Andrew Godwin
You cannot use gunicorn to run WebSockets or other async code - you need an
ASGI server, like Daphne or uvicorn. Switch to one of those and it should
start working.

Andrew

On Fri, Nov 16, 2018 at 8:11 PM Robert Fox  wrote:

> I am working on a project using Django and Channels 2.1.1. Everything is
> working splendidly on my home PC but when I deploy to AWS I get the error:
> 'WebSocket connection to 'ws://IP/ws/lobby/' failed: Error during WebSocket
> handshake: Unexpected response code: 404 ' which originates from the line
> in my HTML where I establish the chat socket :
> var chatSocket = new WebSocket(
> 'ws://' + window.location.host + '/ws/' + roomName + '/'
> );
> I am using nginx and gunicorn to run my Django application on the host
> machine.
> When I went to the Channels 2 tutorial it has a section for testing
> communication between the channels layer and Redis using the
> Django Shell which I tested and works.
> My full code can be seen at https://github.com/Rob-Fox/Chat2
>
> Thank you
>
> --
> 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/16ed620b-c05f-4392-8d84-6cbd85436ca2%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/16ed620b-c05f-4392-8d84-6cbd85436ca2%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1uq_EsgV2jt-PzMFsL1%2BAnQqEX0r4XHjLKPa5D_XZcfi4w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels + django-tenants

2018-11-14 Thread Andrew Godwin
Hm, that's not sufficiently better than just supplying a new middleware to
be honest. The sort of hooks I prefer are where you can subclass and
improve what we ship with and give the user a new, non-fragile one, whereas
that just sounds like it's injecting a function in.

Honestly, given Channels is currently only one maintainer, any increase in
surface area is unlikely unless there's a very good reason. Channels' auth
stuff is just standard Django code + settings for the most part, so there's
already bits you can reuse to do most of the work.

Andrew

On Tue, Nov 13, 2018 at 3:00 PM  wrote:

> I know this is not general, but maybe `get_user` could accept an optional
> function as second parameter, so that the function could wrap the inner
> content of the current `get_user`. django-tenants provides a regular
> middleware, but I think the async breaks any attempt to handle this through
> a channels-like middleware.
>
> --
> 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/f99a231f-cdc5-426f-8d0a-20c0f8ebc2fc%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f99a231f-cdc5-426f-8d0a-20c0f8ebc2fc%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1uor2Y0xdzogVEgZLM54qRrnuDAuKaN3T_5YkOO5nZCt3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels + django-tenants

2018-11-13 Thread Andrew Godwin
What sort of hook would you be imagining? The DB connection stuff is deep
inside Django itself, rather than in Channels, so I'm not sure what
sensible top-level thing we could provide that would make sense.

Andrew

On Tue, Nov 13, 2018 at 2:16 PM  wrote:

> Django-tenants is a package to provide multi-tenancy in Django through
> Postgres schemas (https://github.com/tomturner/django-tenants/)
>
> Django-tenants relies on setting the schema on the connection in order to
> make queries to the right Postgres schema. When you want to secure your
> consumers with user permissions, django-tenants needs to be properly routed
> in order to retrieve the right users from database, otherwise the user in
> scope is not properly populated for permission checking.
>
> In order to overcome this, I have redefined (in a not DRY way, aka
> copy/paste) `get_user`, `TenantAuthMiddleware` and
> `TenantAuthMiddlewareStack`, just because I basically need to wrap
> `get_user` inside `with scope["tenant"]` (provided I put the tenant in the
> scope before, in a custom router.)
>
> Is there any way to provide a hook so this can be achieved in a DRY way?
>
> --
> 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/c547563c-a8a6-416c-bf59-54907f512c77%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/c547563c-a8a6-416c-bf59-54907f512c77%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1uraywimYgY4BmsqxMf8n921WJ0-ZZLLLNJYcd%3D%3Dpaz%3DOA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels group_send hangs in extrenal process

2018-11-13 Thread Andrew Godwin
I've never tried using the async-to-sync stuff with multiprocessing -
first, I'd try removing that and see if it still works (just run from a
management command or script directly).

If it still fails, I'd suggest running a redis MONITOR to see if any
traffic makes it to Redis at all.

Andrew

On Tue, Nov 13, 2018 at 2:07 PM Yaro Kifor  wrote:

> Hello,
>
> I am a little new to channels, but I can't seem to figure out this issue.
> I am trying to use group_send from an external process and I am using Redis
> as my channel backend. Here is what my process code looks like:
>
>
> from channels.layers import get_channel_layer
> from multiprocessing import Process
> from asgiref.sync import AsyncToSync, SyncToAsync
>
> class GenericAgent(Process):
> def __init__(self, *args, **kwargs):
> self.channel_layer = get_channel_layer()
> self.send_message = AsyncToSync(self.channel_layer.group_send)
> super().__init__(*args, **kwargs)
>
> def run(self):
> while True:
> print("Sending data")
> self.send_message('test', {'test': 0})
>time.sleep(1)
>
>
> Anytime I run the process it will print out "Sending data" once and do
> nothing else. Any channel that is part of the test group will not receive
> anything as well. If anyone has a clue to what the issue might be please
> let know your help is greatly appreciated.
>
> Here is my pip freeze:
>
> aioredis==1.2.0
> asgiref==2.3.2
> async-timeout==3.0.1
> attrs==18.2.0
> autobahn==18.11.1
> Automat==0.7.0
> certifi==2018.4.16
> channels==2.1.5
> channels-redis==2.3.1
> chardet==3.0.4
> constantly==15.1.0
> daphne==2.2.3
> Django==2.0.6
> easy-thumbnails==2.5
> future==0.15.2
> hiredis==0.2.0
> hyperlink==18.0.0
> idna==2.7
> imageio==2.3.0
> incremental==17.5.0
> interop==0.0.0
> LatLon23==1.0.7
> monotonic==1.2
> msgpack==0.5.6
> numpy==1.14.4
> Pillow==5.1.0
> psycopg2-binary==2.7.5
> PyHamcrest==1.9.0
> pyproj==1.9.5.1
> pytz==2018.4
> rawpy==0.10.1
> requests==2.19.1
> six==1.11.0
> sorl-thumbnail==12.4.1
> Twisted==18.9.0
> txaio==18.8.1
> urllib3==1.23
> zope.interface==4.6.0
>
>
> Thanks in advance,
> Yaro
>
> --
> 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/4916f184-9db9-4d34-a9cd-3d6ff5238aff%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/4916f184-9db9-4d34-a9cd-3d6ff5238aff%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1upK-iXuxbZNTcPu78OzPnDAfS8-E%3DfOHnPUio0u1dppRw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels: Test case fails on async.sleep(X>0)

2018-11-13 Thread Andrew Godwin
Couple of points:

- Did you install pytest-django? That should help the settings thing.
- There's a default 1-second timeout on get_response; pass timeout=4 to it
and you should see that error go away.

We have a default timeout because otherwise we can't tell if an async app
has died/crashed and it'd hang forever!

Andrew

On Mon, Nov 12, 2018 at 3:43 PM Zhiyu (Drew) Li  wrote:

> Hi there,
>
> I was trying to write a test for a consumer. It is just a very simply
> AsyncHttpConsumer subclass that awaits on asyncio.sleep(3) and returns a
> "OK" in plain text.
>
> The test case is:
> @pytest.mark.asyncio
> async def test_my_consumer():
> communicator = HttpCommunicator(BasicHttpConsumer, "GET", "asynchttp")
> response = await communicator.get_response()
> assert response["status"] == 200
> assert response["body"] == b"OK"
>
> 1) Error 1:
> I run it with command "pytest .py"
> The first error I got was:
> django.core.exceptions.ImproperlyConfigured: Requested settings, but
> settings are not configured. You must either define the environment
> variable DJANGO_SETTINGS_MODULE or call settings.configure() before
> accessing settings.
>
> I google online and found this fix:
> os.environ.setdefault("DJANGO_SETTINGS_MODULE", "MODULE_PATH_TO.settings")
>
>
> 2) Error 2:
> The new error I am getting is:
> self = , exc_type =  'concurrent.futures._base.CancelledError'>
>
> def _do_exit(self, exc_type: Type[BaseException]) -> None:
> if exc_type is asyncio.CancelledError and self._cancelled:
> self._cancel_handler = None
> self._task = None
> >   raise asyncio.TimeoutError
> E   concurrent.futures._base.TimeoutError
>
> But If I change async.sleep(3) to  async.sleep(0) the test passed. Not
> sure why
>
> Also how to test url mapping works correctly?
>
> Thanks
> Drew
>
>
> --
> 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/CAMmsbUk-3AemjcTxxidf4GBvKeWG7b72qwfUcs5owReTeOEMiw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMmsbUk-3AemjcTxxidf4GBvKeWG7b72qwfUcs5owReTeOEMiw%40mail.gmail.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1uq02V6p53P84z0kJo13jrVWDtAr7_qoZ69L1cntQXww6w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django channels worker loses some messages

2018-11-11 Thread Andrew Godwin
Are you using Channels 1 or Channels 2? And which channel layer are you
using?

Andrew

On Sun, Nov 11, 2018 at 5:05 AM Parsa Banihashemi <
parsa.banihash...@gmail.com> wrote:

> Hi,
> I have a simple sync consumer which receives websocket messages from the
> client, and each time, It passes a message to a worker channel to process
> it.
> A LOT of the messages are just simply lost and not processed.
> I have a print ("sent") whenever a message is sent to the worker channel.
> I have another print("received") statement at the beginning of worker's
> method.
> If I send tasks to the worker more frequently that every 2-3 seconds, the
> worker simply just ignores them. I see the "sent" in main stdout, but not
> received in the worker's stdout
> I have to wait 2-3 seconds and send another message to see "received"
> statement in stdout
>
> That is so strange and disappointing. I am debugging on Windows Pycharm,
> and running the worker process correctly I guess
>
> I appreciate any insights
>
> --
> 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/53dbaf3e-5bee-4a54-a4b5-51be2bcf60d3%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/53dbaf3e-5bee-4a54-a4b5-51be2bcf60d3%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1urO-p61bu5i%2B4g4w0OVdaWZwWU8XS9XGCFNXK-Pu3qHwQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Library not loaded: libssl.1.0.0.dylib New Mac on Mohave

2018-11-10 Thread Andrew Troiano
Hey,

I am trying to get my app running on a new Mac.  It's on Mohave, python 
2.7, here is the stack trace. https://dpaste.de/m9WO .  We are getting 
Library not loaded: libssl.1.0.0.dylib when trying to connect to remote 
mysql database.

Thanks!

-- 
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/ce38e5ce-d82d-4653-9fc4-1f464dbbd876%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channel: Migrate regular Django project to Channels2

2018-11-07 Thread Andrew Godwin
Channels doesn't take over at all unless you configure an async consumer.
To make sure it's working I'd recommend writing a single async consumer,
and running a test against that to ensure it works.

Andrew

On Wed, Nov 7, 2018 at 1:11 PM Zhiyu (Drew) Li  wrote:

> Hi there,
>
> I am trying to migrate an existing Django project to Channels2. We want to
> keep all existing sync codes unchanged and we will continue mode of the
> development in sync mode. But having Channels opens the opportunity to
> develop some features in async mode.
>
> I was able to install channels2 and get it configured. The portal still
> runs and all tests passed. But does it mean the migration is successful?
> How can I know if the tests were actually run in the channels2 env?
>
> Anything particular I need to double check? like a migration checklist
>
> Thanks
> Drew
>
> --
> 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/CAMmsbU%3DzsYB5J7p4_mC1Gj3HqjiLRLo7Hc4UhaHEN_FXRv0ScA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMmsbU%3DzsYB5J7p4_mC1Gj3HqjiLRLo7Hc4UhaHEN_FXRv0ScA%40mail.gmail.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1uqEeB%2BmdUQ8DYbUFfdRBCqr7Bv5R_2GqT9mb53buovdBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding Channels to and Existing Django Application

2018-11-06 Thread Andrew Godwin
I'm afraid I don't have an easy example to hand - maybe someone else does.
It sounds like you might have something odd in your settings, models.py, or
other files that load at startup.

Andrew

On Tue, Nov 6, 2018 at 5:31 AM  wrote:

> even down to running two different servers for that project, one normal
>> WSGI one and one ASGI one to let you do async things.
>
>
> I've tried doing that, but failed. I've created a asgi.py file and tried
> to run it with daphne, but the server didn't start. Daphne simply hang
> there. To my surprise, the same asgi.py file works fine on a completely
> independent django project. My best guess is that something on the
> convoluted settings.py is messing up with daphne.
>
> Are you aware of a project that does what you've mentioned? Would you
> point me to it? I think that looking at the config files could help me set
> this up.
>
> Juarez
>
> On Monday, November 5, 2018 at 9:24:39 PM UTC-2, Andrew Godwin wrote:
>>
>> Hey,
>>
>> You can just add channels to an existing Django project and only use it
>> for the bits you need it for - even down to running two different servers
>> for that project, one normal WSGI one and one ASGI one to let you do async
>> things.
>>
>> You shouldn't migrate any existing code to channels - just add it and
>> then use it for the new bits you need it for, basically.
>>
>> Andrew
>>
>> On Sun, Nov 4, 2018 at 1:16 PM  wrote:
>>
>>> Greetings y'all!
>>>
>>> I'm looking for recommendations regarding adding Channels to an existing
>>> Django 1.11 application.
>>>
>>> Every guide I've followed assumes that one is using Channels to build an
>>> application from scratch, and that is OK to replace django's native calls
>>> by Channels.
>>>
>>> Channels' documentation suggests different ways of setting up
>>> authentication, sessions, etc, but it is not clear to me that every feature
>>> of Django 1.11 has its counterpart
>>> on Channels. I am afraid I'll spend days migrating my system to Channels
>>> only to figure out that a particular feature of Django is not supported by
>>> Channels. In order to avoid that I've decided to ask y'all first.
>>>
>>> Ideally, I would like to set Channels on a particular Django app, not on
>>> the entire Django project (other apps would not be aware of Channels being
>>> setup). Is that possible?
>>>
>>> If this is not possible, my best guess is that I would need to add
>>> Channels to an independent Django project, and have these two servers
>>> communicate. This 2nd server would point to the same database as the 1st,
>>> and thus would be able to run authentication with same credentials, among
>>> other data related operations.
>>>
>>> I appreciate any guidance on this matter.
>>>
>>> --
>>> 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/a8c4164a-ffbb-4975-8d48-f8f058466b4d%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/a8c4164a-ffbb-4975-8d48-f8f058466b4d%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> 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/5cba75bd-19cc-4a10-97bc-e85ffc51cca3%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/5cba75bd-19cc-4a10-97bc-e85ffc51cca3%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1uqjQzKmzDoHhXE-M5a1B-XuJ7tRhpjhvJr%2Bf056Lck9DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels: event loop and thread

2018-11-06 Thread Andrew Godwin
Your assumptions are correct. The only extra thing to be aware of is that
some Django interactions (like the Channels Auth middleware) need to do
database connections and thus have to launch into a subthread for that, but
that's also managed.

Andrew

On Tue, Nov 6, 2018 at 4:41 AM Zhiyu (Drew) Li  wrote:

> Hi there,
>
> I got the following 2 questions
>
> There is only one thread (MainThread) and one event loop running on it by
> default if all existing consumers are asynchronous consumers?
>
> Regular sync views (if any) are handled by Threadpoolexecutor and run in a
> sub Thread. These sync views won't block the event loop in the main thread.
> Channels takes care of this subthread and I don't need to explicitly manage
> it. Right?
>
> Thanks
> Drew
>
>
> --
> 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/CAMmsbUkjbuRvYjoZDyDY%3DXkaoQJHHiG659XKX-tPCbe7HqgivA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMmsbUkjbuRvYjoZDyDY%3DXkaoQJHHiG659XKX-tPCbe7HqgivA%40mail.gmail.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1urN2bWHedWU1YfpXYmGiZ8z%2BAdE4PUX_sitTtD6-EriVQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding Channels to and Existing Django Application

2018-11-05 Thread Andrew Godwin
Hey,

You can just add channels to an existing Django project and only use it for
the bits you need it for - even down to running two different servers for
that project, one normal WSGI one and one ASGI one to let you do async
things.

You shouldn't migrate any existing code to channels - just add it and then
use it for the new bits you need it for, basically.

Andrew

On Sun, Nov 4, 2018 at 1:16 PM  wrote:

> Greetings y'all!
>
> I'm looking for recommendations regarding adding Channels to an existing
> Django 1.11 application.
>
> Every guide I've followed assumes that one is using Channels to build an
> application from scratch, and that is OK to replace django's native calls
> by Channels.
>
> Channels' documentation suggests different ways of setting up
> authentication, sessions, etc, but it is not clear to me that every feature
> of Django 1.11 has its counterpart
> on Channels. I am afraid I'll spend days migrating my system to Channels
> only to figure out that a particular feature of Django is not supported by
> Channels. In order to avoid that I've decided to ask y'all first.
>
> Ideally, I would like to set Channels on a particular Django app, not on
> the entire Django project (other apps would not be aware of Channels being
> setup). Is that possible?
>
> If this is not possible, my best guess is that I would need to add
> Channels to an independent Django project, and have these two servers
> communicate. This 2nd server would point to the same database as the 1st,
> and thus would be able to run authentication with same credentials, among
> other data related operations.
>
> I appreciate any guidance on this matter.
>
> --
> 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/a8c4164a-ffbb-4975-8d48-f8f058466b4d%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/a8c4164a-ffbb-4975-8d48-f8f058466b4d%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1uprrm2fVuC6mpX6OdHWPb55S1v%3DT%2BJP8vss_%3Dz1_p2DMA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Use Email to Login With Django Auth

2018-11-01 Thread Andrew Pinkham
You may be interested in django-improved-user, as it provides an email-based 
User model.

https://pypi.org/project/django-improved-user/

Full disclosure: I am one of the original authors. If you have any trouble with 
the package or documentation, please open an issue!

Andrew
https://jambonsw.com
https://django-unleashed.com

-- 
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/D94CF79F-E8D0-48B8-9203-033C715EF0FC%40andrewsforge.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to subclass AsyncHttpConsumer for a GET request?

2018-10-30 Thread Andrew Godwin
You need to route by URL - see the example in the docs here, including how
to fallback to Django views:
https://channels.readthedocs.io/en/latest/topics/routing.html#urlrouter

Andrew

On Tue, Oct 30, 2018 at 5:05 AM Zhiyu (Drew) Li  wrote:

> Thanks! Another question it seems once I manually put 'http':
> MyAsyncHttpConsumer pair in the ProtocolRouter, all existing sync http
> views stopped running as their type is "http" as well. So how to do a mix
> of async HTTP and sync http?
> Thanks
> Drew
>
> On Mon, Oct 29, 2018, 23:15 Andrew Godwin  wrote:
>
>> Yup, that's the right way - subclass the async consumer class and then
>> write a handle method. You have to do your own post/get distinctions, like
>> in a Django view, but with the scope rather than the request.
>>
>> Andrew
>>
>> On Mon, Oct 29, 2018 at 4:37 PM Zhiyu/Drew Li  wrote:
>>
>>> Not sure if this is the best way. I just found
>>> inside AsyncHttpConsumer.handle() I can access self.scope['method'] to
>>> determine if it is a GET or POST or others.
>>>
>>> Thanks
>>> Drew
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Monday, October 29, 2018 at 3:50:43 PM UTC-6, Zhiyu/Drew Li wrote:
>>>>
>>>> Hi there,
>>>>
>>>> Newbie to Channels.
>>>>
>>>> I am trying to write a Async consumer to handle a http GET request
>>>> How to write a subclass MyAsynHttpConsumer(AsyncHttpConsumer) for this
>>>> purpose? Or I am looking at the wrong class?
>>>>
>>>> Also if I understand correctly, I should manually add a new pair
>>>> 'http': MyAsynHttpConsumer to ProtocolTypeRouter()
>>>>
>>>> async_http_urlpatterns = [
>>>> url(r'^async-http/$', consumers. MyAsynHttpConsumer   ),
>>>> ]
>>>>
>>>> ProtocolTypeRouter (
>>>> 'http': AuthMiddlewareStack(
>>>> URLRouter(
>>>>  my_channels_app.routing.async_http_urlpatterns
>>>> )
>>>> ),
>>>> )
>>>>
>>>> Thanks
>>>> Drew
>>>>
>>>>
>>>>
>>>> --
>>> 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/8c46871d-6e24-47e1-8813-5721014aedca%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/8c46871d-6e24-47e1-8813-5721014aedca%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> 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/zQcvIvqapCo/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/msgid/django-users/CAFwN1uopgpGn7uASW0%2BteonKN8qQFdBXcwA2N8_JM1-CTYiDdg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAFwN1uopgpGn7uASW0%2BteonKN8qQFdBXcwA2N8_JM1-CTYiDdg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>> 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/CAMmsbUnQC-MFDHCV2Py1B_BajRRHDQJGjkOowSMBcNOULfTx%3DA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMmsbUnQC-MFDHCV2Py1B_BajRRHDQJGjkOowSMBcNOULfTx%3DA%40mail.gmail.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1uq0-9SusXtrQkw1GaN_Cv37QdA99-sGSo4Sg0vcccbhmQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to subclass AsyncHttpConsumer for a GET request?

2018-10-29 Thread Andrew Godwin
Yup, that's the right way - subclass the async consumer class and then
write a handle method. You have to do your own post/get distinctions, like
in a Django view, but with the scope rather than the request.

Andrew

On Mon, Oct 29, 2018 at 4:37 PM Zhiyu/Drew Li  wrote:

> Not sure if this is the best way. I just found
> inside AsyncHttpConsumer.handle() I can access self.scope['method'] to
> determine if it is a GET or POST or others.
>
> Thanks
> Drew
>
>
>
>
>
>
> On Monday, October 29, 2018 at 3:50:43 PM UTC-6, Zhiyu/Drew Li wrote:
>>
>> Hi there,
>>
>> Newbie to Channels.
>>
>> I am trying to write a Async consumer to handle a http GET request
>> How to write a subclass MyAsynHttpConsumer(AsyncHttpConsumer) for this
>> purpose? Or I am looking at the wrong class?
>>
>> Also if I understand correctly, I should manually add a new pair 'http':
>> MyAsynHttpConsumer to ProtocolTypeRouter()
>>
>> async_http_urlpatterns = [
>> url(r'^async-http/$', consumers. MyAsynHttpConsumer   ),
>> ]
>>
>> ProtocolTypeRouter (
>> 'http': AuthMiddlewareStack(
>> URLRouter(
>>  my_channels_app.routing.async_http_urlpatterns
>> )
>> ),
>> )
>>
>> Thanks
>> Drew
>>
>>
>>
>> --
> 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/8c46871d-6e24-47e1-8813-5721014aedca%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/8c46871d-6e24-47e1-8813-5721014aedca%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1uopgpGn7uASW0%2BteonKN8qQFdBXcwA2N8_JM1-CTYiDdg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels -- a question about how ProtocolTypeRouter works

2018-10-26 Thread Andrew Godwin
I would instead think of the object that ends up there as a factory that
makes the final objects that end up per-scope. It's slightly confusing, I
will grant you, but in Python anything can make a new class instance, not
just a class constructor, which is what's happening here.

Andrew

On Fri, Oct 26, 2018 at 3:17 PM Zhiyu (Drew) Li  wrote:

> Thanks!  So that means some objects last across multiple scopes, and they
> can create another obj that only lasts for one specific scope?
> I am still confused how the different layers of middleware wrap around the
> real asgi application -- a obj just lasts for one scope.
> I need to go through the code deeper.
>
> Thanks
> Drew
>
>
>
> On Fri, Oct 26, 2018 at 4:07 PM Andrew Godwin  wrote:
>
>> Hi Drew,
>>
>> The return value is indeed an object, but if you look closely at it
>> you'll see it defines a __call__ method - meaning that when it's called as
>> an ASGI application, it then returns a further object to act inside the
>> scope.
>>
>> Andrew
>>
>> On Fri, Oct 26, 2018 at 2:55 PM Zhiyu/Drew Li  wrote:
>>
>>> Hi,
>>>
>>> Newbie here. (please bear with me if this a stupid question)
>>>
>>> I am going through the tutorial and doc and got this question regarding how 
>>> ProtocolTypeRouter works.
>>> ProtocolTypeRouter.__init__ takes a dict "application_mapping" and append a 
>>> key-value pair to it: "http': class AsgiHandler
>>> As doc says ASGI application is created on a per scope basis, I think I 
>>> vaguely understand how the "http" one works.
>>> Once a http scope comes in, an instance/object of class AsgiHandler is 
>>> initiated, which lasts for the duration of the scope.
>>> So it is one scope leads to one ASGI application/object
>>>
>>> But I am confused about this one:
>>> application = ProtocolTypeRouter({
>>> # (http->django views is added by default)
>>> 'websocket': AuthMiddlewareStack(
>>> URLRouter(
>>> chat.routing.websocket_urlpatterns
>>> )
>>> ),
>>> })
>>> The whole value of this key-value pair 
>>> AuthMiddlewareStack(URLRouter(chat.routing.websocket_urlpatterns)) seems to 
>>> be a object not a class,
>>> so that means the application already exists before a websocket scope comes 
>>> in. How does this conform to "one scope one application" rule?
>>>
>>> Any help would be appreciated.
>>>
>>> Thanks
>>> Drew
>>>
>>>
>>> --
>>> 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/f6088bd4-457a-4106-b883-332af9a99337%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/f6088bd4-457a-4106-b883-332af9a99337%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> 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/CAFwN1urusiZjfH2HSnkaRcuNVUXMgLuLRxs%3DxH9tK%3D35enFDow%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAFwN1urusiZjfH2HSnkaRcuNVUXMgLuLRxs%3DxH9tK%3D35enFDow%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>> 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 t

Re: Channels -- a question about how ProtocolTypeRouter works

2018-10-26 Thread Andrew Godwin
Hi Drew,

The return value is indeed an object, but if you look closely at it you'll
see it defines a __call__ method - meaning that when it's called as an ASGI
application, it then returns a further object to act inside the scope.

Andrew

On Fri, Oct 26, 2018 at 2:55 PM Zhiyu/Drew Li  wrote:

> Hi,
>
> Newbie here. (please bear with me if this a stupid question)
>
> I am going through the tutorial and doc and got this question regarding how 
> ProtocolTypeRouter works.
> ProtocolTypeRouter.__init__ takes a dict "application_mapping" and append a 
> key-value pair to it: "http': class AsgiHandler
> As doc says ASGI application is created on a per scope basis, I think I 
> vaguely understand how the "http" one works.
> Once a http scope comes in, an instance/object of class AsgiHandler is 
> initiated, which lasts for the duration of the scope.
> So it is one scope leads to one ASGI application/object
>
> But I am confused about this one:
> application = ProtocolTypeRouter({
> # (http->django views is added by default)
> 'websocket': AuthMiddlewareStack(
> URLRouter(
> chat.routing.websocket_urlpatterns
> )
> ),
> })
> The whole value of this key-value pair 
> AuthMiddlewareStack(URLRouter(chat.routing.websocket_urlpatterns)) seems to 
> be a object not a class,
> so that means the application already exists before a websocket scope comes 
> in. How does this conform to "one scope one application" rule?
>
> Any help would be appreciated.
>
> Thanks
> Drew
>
>
> --
> 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/f6088bd4-457a-4106-b883-332af9a99337%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f6088bd4-457a-4106-b883-332af9a99337%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1urusiZjfH2HSnkaRcuNVUXMgLuLRxs%3DxH9tK%3D35enFDow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels: about max message size

2018-10-23 Thread Andrew Godwin
Hmm, it's possible the 0.x series didn't have response streaming for files
so there'd be a limit, but I honestly can't remember, that was years ago.
There's really not much I can do other than recommending an upgrade to
something vaguely recent.

Also make sure Heroku is not cutting you off with a request timeout or
something.

Andrew

On Tue, Oct 23, 2018 at 5:38 AM Chris  wrote:

> I use Channels & websockets for my webapp's "export data" functionality,
> since it can take a long time to generate the file (more than 30 seconds).
> In general this works fine, even for large downloads (several MB), but I
> have seen several cases on Heroku where the browser never receives the
> message with the file, even though debugging shows that
> JsonWebsocketConsumer.send was called as expected.
>
> I found this Github issue <https://github.com/django/channels/issues/11> that
> says the message limit is 1 MB (or maybe 256 kb). My questions:
>
> - Where is this limit defined? I searched the source of Channels and
> Daphne. I'm trying to figure out where the failure is happening -- in the
> worker, Daphne, or Redis.
> - What happens if the limit is exceeded? Is an exception raised? (Because
> in my case it fails silently.)
> - Is there really a 1 MB limit? Because it seems I have been able to send
> files larger than that using channels/asgi_redis (unfortunately I'm still
> on channels 0.17.3, can't upgrade yet because of a Twisted bug).
>
> Thanks!
>
> --
> 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/da8fc1ab-8a75-4504-ab3a-6ab31cfd132e%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/da8fc1ab-8a75-4504-ab3a-6ab31cfd132e%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1up4d8i%3DC-t2T_AYqmPYAsaQvNPjqCvn1MHJdwakfJvtNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trigger actions independently of url request

2018-10-22 Thread Andrew Pinkham
On Oct 22, 2018, at 12:08, Charley Paulus  wrote:
> After reading the Django tutorial, my understanding (I hope I’m wrong) is 
> that the only way to trigger a function of a Django app is when someone on 
> the client side request the url related to that function.

That is correct. A view function/object is only called when a site visitor is 
routed to that callable by the URL configuration.

> But what if I want the server to run a function indenpendently of a url call, 
> for example:
> - every 10 minutes
> - when a pre-defined combination of variables become true

I'm not clear on your second condition, but you are probably interested in 
Celery for the first.

http://www.celeryproject.org/

Alternatively, some clouds provide the ability to run code on a regular basis. 
If your Django code is not closely coupled with cron job, you could use AWS 
Lambda.

https://docs.aws.amazon.com/lambda/latest/dg/with-scheduled-events.html

If it is tightly coupled and Celery is too powerful for your needs, you could 
use an AWS Lambda (or Azure Function, etc) to send a request to your Django API 
on a regular basis.

Andrew
https://jambonsw.com
https://django-unleashed.com

-- 
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/7DECDBA7-AF86-468C-A275-CC593CE10F0B%40andrewsforge.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need help with CDN on Django App using heroku

2018-10-22 Thread Andrew Pinkham
On Oct 22, 2018, at 11:53, Akash Purandare  wrote:
> However the issue is not with Whitenoise. Whitenoise can be used to serve 
> static files, yes. But how do I use it to serve media assets in the project?

Sorry, missed the media part.

Michal is right, you will need to install and configure django-storages for S3. 

https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html

Related:
https://docs.djangoproject.com/en/2.1/ref/settings/#media-root
https://docs.djangoproject.com/en/2.1/ref/settings/#media-url

This tutorial may be useful (Updated in 2017):

https://www.caktusgroup.com/blog/2014/11/10/Using-Amazon-S3-to-store-your-Django-sites-static-and-media-files/

Andrew
https://jambonsw.com
https://django-unleashed.com

-- 
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/16D1C20E-91C9-4E16-B4E3-F410F815FA3D%40andrewsforge.com.
For more options, visit https://groups.google.com/d/optout.


Re: Creating seperate unique ids within the same table

2018-10-22 Thread Andrew Pinkham
On Oct 22, 2018, at 12:29, Matthew Pava  wrote:
> I am curious why you think it is anti-practice to expose primary keys for 
> user-visible purposes.
> My URLs all have the PK to the object in them, and any advanced user would be 
> able to “reverse engineer” a URL if they guess the PK of an object—and that’s 
> okay.

https://www.owasp.org/index.php/Top_10_2013-A4-Insecure_Direct_Object_References
https://www.owasp.org/index.php/Insecure_Direct_Object_Reference_Prevention_Cheat_Sheet

> Even Django tutorials suggest using the PK in the URL of an object.

That's an interesting point, and I might argue is a shortcoming in the tutorial.

PRs welcome!

-- 
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/79D86944-B1A3-479B-8959-9477144EBA6F%40andrewsforge.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need help with CDN on Django App using heroku

2018-10-22 Thread Andrew Pinkham
https://devcenter.heroku.com/articles/django-assets
http://whitenoise.evans.io/en/stable/django.html

-- 
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/5027F5EE-03B2-4124-94CB-F88D4E42000E%40andrewsforge.com.
For more options, visit https://groups.google.com/d/optout.


Re: generate username and password

2018-10-22 Thread Andrew Pinkham
Au sujet d'utilisateurs avec email comme pseudonyme, j’ai créé (avec Russell 
Keith-Magee) un projet qui a comme but de fournir des classes et modèles qui 
aident a la création d'utilisateurs custom.

https://django-improved-user.readthedocs.io/en/latest/quickstart.html
https://github.com/jambonsw/django-improved-user/

Si on parle de la façon d’enregistrer de nouveaux utilisateurs, le code dans 
django-registration serait peut-être utile aussi.

https://github.com/ubernostrum/django-registration

A savoir: la classe BaseUserManager vient avec une méthode make_random_password.

https://docs.djangoproject.com/en/2.1/topics/auth/customizing/#django.contrib.auth.models.BaseUserManager

Andrew
https://jambonsw.com <https://jambonsw.com/>
https://django-unleashed.com <https://django-unleashed.com/>

-- 
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/39D445EA-C85C-4AD0-B169-A0C58CB7CE02%40andrewsforge.com.
For more options, visit https://groups.google.com/d/optout.


Re: [channels] 2.1.4 - Removing Javascript library entirely

2018-10-21 Thread Andrew Godwin
That's about right - you should ship and maintain the file yourself now.

Andrew

On Sun, 21 Oct 2018, 09:04 kradem,  wrote:

> Hi everyone!
>
> The subject is related to
> https://github.com/django/channels/commit/2a9d764ad03927581aa2bfcadccc3e953949cb98
>
> > It was very unmaintained, and having it in here sends the wrong message
> about it being useful and reliable.
>
> I used to include the javascript in my templates with:
>
> 
>
> I suppose the only change I should do now is to include the javascript
> file from the 2.1.3 channels version in my project static folder and
> reference it with (if js is the folder for my project's javascript)::
>
> 
>
> Am I missing something else here?
>
> --
> 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/e5a5eca8-54f1-49f8-9159-f7b7c4de847e%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/e5a5eca8-54f1-49f8-9159-f7b7c4de847e%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1uoZkwbKwV6kX12hWGrE3VtyTM1tb2V-7tti38qdn4vgqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels: rejecting web socket connections with a custom close code

2018-10-06 Thread Andrew Godwin
Hi Matt,

This is because the two ways of closing are different - closing before the
socket is open sends a HTTP error code (what browsers report for this is
different in terms of websocket errors), whereas closing once it is open
allows a websocket error to be used.

This is referenced in the spec at
https://asgi.readthedocs.io/en/latest/specs/www.html#websocket but somewhat
obliquely; I’ll try to make it a bit clearer.

Andrew

On Wed, 3 Oct 2018 at 13:23, Matt F  wrote:

> Hello all,
>
> I have a question about the process of accepting/rejecting web socket
> connections in Channels consumers (v2.1.3).  I have found that if I have
> code like this:
>
> class MyConsumer(JsonWebsocketConsumer):
> def connect(self):
> if authenticated:
> self.accept()
> else:
> self.close(4001)
>
>
> then when rejecting a connection the close code always comes through on
> the client side as 1006 (abnormal closure) instead of 4001.  There is a
> stack overflow post about the same issue that led me to an answer that
> solves this:
> https://stackoverflow.com/questions/50009440/django-channels-2-0-websocketbridge-js-403-when-self-codecode-1007
>
> And a code snippet that works correctly is as follows:
>
> class MyConsumer(JsonWebsocketConsumer):
> def connect(self):
> self.accept()
> if not authenticated:
> self.close(4001)
>
>
> The Channels documentation is ambiguous as to which of these is correct.
> Now I think I know the answer as the first way breaks and the second way
> works, but I wanted to check with someone more knowledgeable that this way
> of doing things is by design and not just working by accident.  It feels a
> bit wrong to accept a connection and then immediately close it, but I
> understand if you have to do it this way, to get the custom close code
> returned perhaps you have to have an open connection in the first place.
> Can someone please confirm?
>
> Many thanks!
> Matt
>
> --
> 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/6a4a797c-e590-4f4d-a718-074a3cf704bc%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/6a4a797c-e590-4f4d-a718-074a3cf704bc%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1urect58FqfPUJExwbWd%2BpyWTjU4gLwNdEq9Sm0d1Lv75w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deploying Django app with Channels on Linux Hosting

2018-10-03 Thread Andrew Godwin
Hi there - it sounds like your host does not support websockets. You should
check with them for more.

Andrew

On Wed, 3 Oct 2018 at 23:43, Manjunath  wrote:

> Hi all,
> I have developed a simple app using django channels.
>
> I would like to deploy it on a linux hosting provider (Currently I have
> account with mochahost.com - Web Hosting:mocha package) & I have deployed
> the app there.
> All features of the app are working except for web sockets which give the
> following error: *Error during WebSocket handshake: Unexpected response
> code: 404*
>
> The app in local development system works fine without a glitch but the
> ASGI layer is not working after deployment.
>
> My current host provider is running pyhon apps using  Passenger.
>
> Is there any extra settings I need to do to setup the Socket layer?
> Kindly help me in this issue.
>
> Package versions used:
> Python - 3.6.6
> Django - 2.1.1
> Channels - 2.1.3
> Channels_redis - 2.3.0
>
>
> Hope to get help for this issue..
>
> Thanks & Regards,
> Manjunath
>
> --
> 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/e39d3fb8-bad0-4852-a3df-aa52ebf45d6d%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/e39d3fb8-bad0-4852-a3df-aa52ebf45d6d%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAFwN1uqPpNxOkY-E22vRQw%2B%3D2_iEQ0TJHqVuV-LOn-pMjRYmxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


  1   2   3   4   5   6   7   8   9   10   >