Re: CSRF issue in default login

2022-06-17 Thread mike vickers
I was having a similar issue after setting up https with certbot.
After searching around, I found adding this to settings worked.

CSRF_TRUSTED_ORIGINS = ["https://yourdomain.com";, "https://www.yourdomain.com";]

I'd be curious to hear from others, because I'm *not *an expert in how
to best set up django for production.


On Fri, 17 Jun 2022 at 11:48, Mike Kilmer  wrote:

> Hi.
>
> I'm fairly new to Django. Here's what I need insight on:
>
> Local server, no issue.
>
> On production: CSRF 403 error on login.
>
> There's a cookie loaded on the login page containing csrftoken:
> pAFeeUI8YFXZ2PKRYxOTX1qz4Xgto42WVNi7FFvBlZDqcFLwQ2rdQvVeZBHFSpLW
>
> (Local and Session storage are empty)
>
> In the FORM element:
>
>  value="Vz4FiujD4qkLpxCwWNJU0HCWs4u0Qf4RrMHyJf66rK0cznDbOimeTb7BnIVckANR">
>
> Notice they don't match.
>
> I tried running ./migrate.py clearsessions.
>
> Once, yesterday, it seemed that the error did not occur in an Incognito
> Window, but today it persists even in an incognito window, as well as a
> different browser.
>
> One additional piece of information, I have allauth installed, but it
> doesn't seem to be correctly configured. It's login page is not loading.
>
> Additionally, the problem was there even when I removed allauth from Apps
> and Authentication Backends.
>
> Thanks much.
>
> –Mike
>
> --
> 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/551AFE93-8B25-4CB9-8D3F-F1BF1EC4F585%40mzoo.org
> .
>

-- 
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/CACaDatQQiGcmw62HNgajxBJsibfu%2BW-0LqdhasckNGsK4iymCA%40mail.gmail.com.


Re: Resources for writing tests

2020-12-02 Thread mike vickers
This is perfect, thank you.

On Wed, 2 Dec 2020 at 12:15, Shishir Jha  wrote:

> You can look for obey the testing goat book in python. It covers tdd with
> python and django
>
> On Wed, 2 Dec 2020, 10:12 pm mike vickers,  wrote:
>
>> Does anyone know of any good resources walking you through writing tests
>> for django? I've read through their documentation, and I've written a few,
>> but I'm wondering if there's someone out there with a tutorial that really
>> spells out a good approach.
>>
>> 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/CACaDatTXaqLxMD9H%3D3iXMgLV3%2BRs6%3DYEE6T1XgGGSBnoTm7RNA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CACaDatTXaqLxMD9H%3D3iXMgLV3%2BRs6%3DYEE6T1XgGGSBnoTm7RNA%40mail.gmail.com?utm_medium=email&utm_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/CA%2BC7wFR3uH%3DQKo4kp7ZfKSApAhhetYvUCx-ikirRvUwba2dPBw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CA%2BC7wFR3uH%3DQKo4kp7ZfKSApAhhetYvUCx-ikirRvUwba2dPBw%40mail.gmail.com?utm_medium=email&utm_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/CACaDatT16zc4b-LCJ3j%2BRRpmOyF_p%2BF8_T6gmkkSnzyBpSVLOQ%40mail.gmail.com.


Resources for writing tests

2020-12-02 Thread mike vickers
Does anyone know of any good resources walking you through writing tests
for django? I've read through their documentation, and I've written a few,
but I'm wondering if there's someone out there with a tutorial that really
spells out a good approach.

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/CACaDatTXaqLxMD9H%3D3iXMgLV3%2BRs6%3DYEE6T1XgGGSBnoTm7RNA%40mail.gmail.com.


Re: Django User authentication OR Custom Model For the Situation

2020-11-23 Thread mike vickers
https://simpleisbetterthancomplex.com/tutorial/2016/07/22/how-to-extend-django-user-model.html

This is a nice reference that goes over the pros/cons of the different
approaches to your problem.

On Mon, 23 Nov 2020 at 08:41, Neeraj Rana  wrote:

> I am trying to create two different types of users, prime and one prime
> with that it also consist of email verification and custom username.
> Now, my question is should I use the user auth model, and django.forms and
> extend the form for email, phone no or should i build a completely new
> model and form?
> Hope to have a reply
>
> --
> 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/e2a764bf-e302-4bcf-b66d-cbde1864e019n%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/CACaDatQ4pJa3oRm9R-2UErEv5v8FH0tKvQPnf-APLJUA_8xS-w%40mail.gmail.com.


Re: Deploying in aws/Heroku

2020-11-18 Thread mike vickers
https://www.youtube.com/watch?v=kt3ZtW9MXhw&list=PL-osiE80TeTtoQCKZ03TU5fNfx2UY6U4p&index=16

This whole django tutorial is pretty good on basics, and worth a watch.

On Wed, 18 Nov 2020 at 09:45, Siddharth Nahata 
wrote:

> Hi All,
>
> I have been learning for 2 months now and i have created a ecommerce
> project using django & react. Now i wanted to deploy this project using
> Aws/Heroku.
> Do you guys know any video series/resources from where i can learn to
> deploy this project.
> waiting for the response.
>
> Thanks & regards,
> Siddharth Nahata
>
> --
> 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/6f5cb687-dc35-445b-9097-625d8cd68a16n%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/CACaDatRJuoUVcVK4LGnthLghH0pyhDHOPCTamKVJwMD4pA10BA%40mail.gmail.com.


Re: How to print sequence number in python

2020-11-14 Thread mike vickers
Python has the enumerate function for these situations.

for i, item in enumerate(items):
 #your print statement here

'i' will give you the index of the list/iterable, and item will give you
the item.

On Sat, 14 Nov 2020 at 11:57, paidjoo indo  wrote:

> Hello I'm newbie in python, I'm learning looping in python, how to print
> like in bellow;
> Input:5
> 12345
> 2.  4
> 3   3
> 4   2
> 54321
>  Thanks guys
>
> --
> 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/CAO%3D2VJmeOF5SyMZUFox_hHivTr%3DE%3Dnekj_n7FLOYjGOkPHQrbA%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/CACaDatTeC6sFyFjiyKhkBjkpYpc7uk8hWsFAfagk8eh4k%3DrQ_w%40mail.gmail.com.


Re: im a newbe, i'm trying to get the username in a view

2020-11-14 Thread mike vickers
You would want to include that line in a method, not as a class attribute.
For example:

def get(self, request):
user = request.user.username
...
return render(...


On Sat, Nov 14, 2020 at 9:37 AM Kasper Laudrup 
wrote:

> Hi Barbara,
>
> On 13/11/2020 22.46, Barbara Leonard wrote:
> > make an attribute named "user"
> >
>
> How would that help? The attribute value should be set to the currently
> logged in user. Just adding the attribute to request object will not do
> that. Clearly something else is missing.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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/93f48576-7bf0-b46d-9403-5f0c23f3babc%40stacktrace.dk
> .
>

-- 
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/CACaDatT8mUT142AYWuw6wemqLMzbKjCvZyT%3DAqi-_WoZrYsn9Q%40mail.gmail.com.