How can I serve an Angular app from root?

2023-02-26 Thread Zayd Krunz
Hello,
I have a prebuilt Angular app, which is basically just static files. How 
can I serve it from the root project? If I set STATIC_URL to "/", I get the 
following:

django.core.exceptions.ImproperlyConfigured: runserver can't serve media if 
MEDIA_URL is within STATIC_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/60f7e50e-7900-46f1-a91e-67038ea91e30n%40googlegroups.com.


Re: it is very hard to find both email and phone number as username to login

2023-02-26 Thread Raphael Polanco
The username would be both a security risk and too damn long.

On Sun, Feb 26, 2023 at 9:20 AM Adeyemi Deji  wrote:

> Y do u need both?
>
> On Sun, 26 Feb 2023, 15:13 Manobhav Joshi,  wrote:
>
>> is there any way to use both email and phone number as username to login
>> safely which we can use authenticate() function.
>>
>> --
>> 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/fd5721c4-0a55-48c3-8a1c-5ef75e470e1cn%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/CAEO1Gron3DwbppShgPmED%2BfR%3DgbEfhKeuUu1M3dPeXgNoQbaSA%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/CAJoAtSmqRKqfFL%2B5qBRnhrS6nVK6M1Btfj9d7JmG_EkcQr%2BKZA%40mail.gmail.com.


Re: it is very hard to find both email and phone number as username to login

2023-02-26 Thread Paul Kudla (SCOM.CA Internet Services Inc.)



I use a plugin / python program

AUTHENTICATION_BACKENDS = (
# AxesStandaloneBackend should be the first backend in the 
AUTHENTICATION_BACKENDS list.

'axes.backends.AxesModelBackend',

'django.contrib.auth.email-auth.EmailBackend',
'django.contrib.auth.backends.ModelBackend',
 )

email-auth.py

place in project root or

/usr/local/lib/python2.7/site-packages/Django-1.11.29-py2.7.egg/django/contrib/auth

use phone number for the user account id and email address will kick in 
automatically


can use either for login with valid password



___
# cat email-auth.py
from django.contrib.auth.models import User
import re

# vem = Verify E-Mail.  This regular expression is from 
http://www.regular-expressions.info/email.html

# and is designed to detect anything that meets the RFC-2822 standard.
vem = 
re.compile(r"""(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])""", 
re.I)



class BasicBackend:
def get_user(self, user_id):
try:
return User.objects.get(pk=user_id)
except User.DoesNotExist:
return None

class EmailBackend(BasicBackend):
def authenticate(self, username=None, password=None):
#If username is an email address, then try to pull it up
if vem.search(username):
try:
user = User.objects.get(email=username)
except User.DoesNotExist:
return None
else:
#We have a non-email address username we should 
try username

try:
user = User.objects.get(username=username)
except User.DoesNotExist:
return None
if user.check_password(password):
return user





Happy Sunday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services 
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 2023-02-26 8:35 a.m., Manobhav Joshi wrote:
is there any way to use both email and phone number as username to login 
safely which we can use authenticate() function.


--
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/fd5721c4-0a55-48c3-8a1c-5ef75e470e1cn%40googlegroups.com .


--
This message has been scanned for viruses and
dangerous content by *MailScanner* , and is
believed to be clean.


--
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/a875a175-d6d2-1ab2-c9aa-3460ee1e97c8%40scom.ca.


Re: it is very hard to find both email and phone number as username to login

2023-02-26 Thread Adeyemi Deji
Y do u need both?

On Sun, 26 Feb 2023, 15:13 Manobhav Joshi,  wrote:

> is there any way to use both email and phone number as username to login
> safely which we can use authenticate() function.
>
> --
> 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/fd5721c4-0a55-48c3-8a1c-5ef75e470e1cn%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/CAEO1Gron3DwbppShgPmED%2BfR%3DgbEfhKeuUu1M3dPeXgNoQbaSA%40mail.gmail.com.


it is very hard to find both email and phone number as username to login

2023-02-26 Thread Manobhav Joshi
is there any way to use both email and phone number as username to login 
safely which we can use authenticate() function.

-- 
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/fd5721c4-0a55-48c3-8a1c-5ef75e470e1cn%40googlegroups.com.