Feb-16-2018, 07:31 PM
From inside my Django project directory, I invoked:
I’ve noticed a pattern. It appears that when a Django script (settings.py for example) is run and the libraries are imported at the top of the script (or in the case when the
This string: django.contrib.auth.password_validation.UserAttributeSimilarityValidator in pseudocode, the pattern would reflect this:
‘DjangoDirectory.ContribDirectory.AuthDirectory.ThisModule.ThisClass’.
Then the methods (there are multiple) within that Class can be called and manipulated inside settings.py at runtime, like when the server is actively running servicing client requests.
In your case, @knackwurstbagel, your venv is located not inside your Django project directory but inside /usr/local/ which is better practices because it is more secure. I’ll look into it.
Thank you, Thank you, @knackwurstbagel for your helpful advice and for nudging me in the right direction rather than giving me the answer outright.
$ locate password_validation /home/tranq/cel2fah/venv/lib/python3.4/site-packages/django/contrib/auth/password_validation.py /home/tranq/cel2fah/venv/lib/python3.4/site-packages/django/contrib/auth/__pycache__/password_validation.cpython-34.pyc /usr/local/lib/python3.4/dist-packages/django/contrib/auth/password_validation.py /usr/local/lib/python3.4/dist-packages/django/contrib/auth/__pycache__/password_validation.cpython-34.pyc $The first and second lines of outputs are my Django project directories inside my virtual environment and the third and fourth lines of output are my distribution directories in my native machine.
I’ve noticed a pattern. It appears that when a Django script (settings.py for example) is run and the libraries are imported at the top of the script (or in the case when the
AUTH_PASSWORD_VALIDATORS
variable is declared) it looks inside site-packages
(inside my virtual environment) for the django
directory, then for the auth
directory which contains the password_validation.py
module. settings.py refers to four classes inside the password_validation script: - UserAttributeSimilarityValidator
- MinimumLengthValidator
- CommonPasswordValidator
- NumericPasswordValidator
This string: django.contrib.auth.password_validation.UserAttributeSimilarityValidator in pseudocode, the pattern would reflect this:
‘DjangoDirectory.ContribDirectory.AuthDirectory.ThisModule.ThisClass’.
Then the methods (there are multiple) within that Class can be called and manipulated inside settings.py at runtime, like when the server is actively running servicing client requests.
In your case, @knackwurstbagel, your venv is located not inside your Django project directory but inside /usr/local/ which is better practices because it is more secure. I’ll look into it.
Thank you, Thank you, @knackwurstbagel for your helpful advice and for nudging me in the right direction rather than giving me the answer outright.