SSL Verification Problem on MacOS

2024-10-05 Thread Kiotseaeton Lancaster
SSL verification fails on django.core.mail.send_mail

The problem isn't with application code, because the application operates
properly on my Windows wsl environment with the same python, venv, openssl
versions.

The problem is with the Mac environment... Has someone come across a
similar problem on Mac? Does it have to do with Mac specific network
security configurations or the way Mac uses certificates with keychain?

-- 
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/CALd9-v8ybV0pA2oBq79-%2BDEu8qGoimB0o3PpBtRh%3D5O-KpTaiQ%40mail.gmail.com.


Re: Postgres failure when trying to remove check constraint

2024-10-05 Thread Sam Brown
For this exact reason I always use `sqlmigrate` to get the auto generated
sql statement (and the backwards sql) and put this statements in
 `forwards` and `backwards` functions. I then separate the db and state
operations.

I bet if you run `python manage.py sqlmigrate  ` on
the migrations that removes the field from the model, you will see the sql
that deletes the index.

On Sat, Oct 5, 2024 at 8:02 AM Alan Evangelista 
wrote:

> I found out the cause was that I recently removed the max_documents field
> in the Template model, Postgres automatically deletes a constraint when one
> of the related columns is deleted and Django does not realize it. I
> manually updated the Django migration that deleted the field to also
> deleted the constrain and it worked fine.
>
> On Fri, Oct 4, 2024, 10:52 Alan Evangelista  wrote:
>
>> Hi, everyone.
>>
>> I have the following db model:
>>
>> class Template(models.Model):
>> max_documents = models.PositiveIntegerField(default=1)
>> is_comparison = models.BooleanField(default=False)
>> ...
>> class Meta:
>> constraints = [
>> models.CheckConstraint(
>> check=models.Q(is_comparison=False) |
>> models.Q(max_documents__gte=2, is_comparison=True),
>> name="is_comparison_requires_min_documents",
>> ),
>> ]
>>
>> I recently added this check constraint above and makemigrations created
>> the following db migration:
>>
>> class Migration(migrations.Migration):
>> dependencies = [
>> ...
>> ]
>>
>> operations = [
>> migrations.AddConstraint(
>> model_name="template",
>> constraint=models.CheckConstraint(
>> check=models.Q(
>> ("is_comparison", False),
>> models.Q(("is_comparison", True),
>> ("max_documents__gte", 2)),
>> _connector="OR",
>> ),
>> name="is_comparison_requires_min_documents",
>> ),
>> ),
>> ]
>>
>> Today I deleted the constraint and ran makemigrations again, which
>> created this second migration:
>>
>> class Migration(migrations.Migration):
>> dependencies = [
>> ...
>> ]
>>
>> operations = [
>> migrations.RemoveConstraint(
>> model_name="template",
>> name="is_comparison_requires_min_documents",
>> ),
>> ]
>>
>> When I try to run the 2nd migration, I get the following Postgres error
>> from Django:
>> django.db.utils.ProgrammingError: constraint
>> "is_comparison_requires_min_documents" of relation "ai_template" does not
>> exist
>>
>> I checked the ai_template table schema and confirmed there is no check
>> constraint there. It seems to me Django didn't create the check constraint
>> on the Postgres db side (maybe it was enforcing it on its side) and now is
>> trying to remove it from Postgres. Is that a bug or am I missing something?
>>
>> Thanks in advance!
>>
>> --
>>
> 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/VBkLU6AP9b4/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/8d16410d-ded2-4f2f-a457-675127825443n%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/CAKz%2BTUsu1BE9EzvUxPHfz8ND%2BWL3uA%2B0ZyM9jsWfG%2BektwUt_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/CALmEK1uFCkmY%3DoYfsUsQRG%2BGR2YcF-4NvsSDOn%3DhrWYMB3vvQg%40mail.gmail.com.


Re: Postgres failure when trying to remove check constraint

2024-10-05 Thread Alan Evangelista
I found out the cause was that I recently removed the max_documents field
in the Template model, Postgres automatically deletes a constraint when one
of the related columns is deleted and Django does not realize it. I
manually updated the Django migration that deleted the field to also
deleted the constrain and it worked fine.

On Fri, Oct 4, 2024, 10:52 Alan Evangelista  wrote:

> Hi, everyone.
>
> I have the following db model:
>
> class Template(models.Model):
> max_documents = models.PositiveIntegerField(default=1)
> is_comparison = models.BooleanField(default=False)
> ...
> class Meta:
> constraints = [
> models.CheckConstraint(
> check=models.Q(is_comparison=False) |
> models.Q(max_documents__gte=2, is_comparison=True),
> name="is_comparison_requires_min_documents",
> ),
> ]
>
> I recently added this check constraint above and makemigrations created
> the following db migration:
>
> class Migration(migrations.Migration):
> dependencies = [
> ...
> ]
>
> operations = [
> migrations.AddConstraint(
> model_name="template",
> constraint=models.CheckConstraint(
> check=models.Q(
> ("is_comparison", False),
> models.Q(("is_comparison", True),
> ("max_documents__gte", 2)),
> _connector="OR",
> ),
> name="is_comparison_requires_min_documents",
> ),
> ),
> ]
>
> Today I deleted the constraint and ran makemigrations again, which created
> this second migration:
>
> class Migration(migrations.Migration):
> dependencies = [
> ...
> ]
>
> operations = [
> migrations.RemoveConstraint(
> model_name="template",
> name="is_comparison_requires_min_documents",
> ),
> ]
>
> When I try to run the 2nd migration, I get the following Postgres error
> from Django:
> django.db.utils.ProgrammingError: constraint
> "is_comparison_requires_min_documents" of relation "ai_template" does not
> exist
>
> I checked the ai_template table schema and confirmed there is no check
> constraint there. It seems to me Django didn't create the check constraint
> on the Postgres db side (maybe it was enforcing it on its side) and now is
> trying to remove it from Postgres. Is that a bug or am I missing something?
>
> Thanks in advance!
>
> --
> 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/VBkLU6AP9b4/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/8d16410d-ded2-4f2f-a457-675127825443n%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/CAKz%2BTUsu1BE9EzvUxPHfz8ND%2BWL3uA%2B0ZyM9jsWfG%2BektwUt_Q%40mail.gmail.com.


Re: SSL Verification Problem on MacOS

2024-10-05 Thread Kiotseaeton Lancaster
issue solved... modified SSL trust attribute on GTS Root 1

On Sat, Oct 5, 2024 at 6:10 PM Kiotseaeton Lancaster 
wrote:

> SSL verification fails on django.core.mail.send_mail
>
> The problem isn't with application code, because the application operates
> properly on my Windows wsl environment with the same python, venv, openssl
> versions.
>
> The problem is with the Mac environment... Has someone come across a
> similar problem on Mac? Does it have to do with Mac specific network
> security configurations or the way Mac uses certificates with keychain?
>

-- 
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/CALd9-v9K4xJj-6SSUkwZk61Fm58HitbTYOehUR1DRCDbnMeO_w%40mail.gmail.com.