Charly
Even if all elements are False
Charly
Evaluation is True
乇PIPHANY❦▧▧❄️
A tuple (or any iterable) that isn't empty always is a True in if statements. No matter what the items are
if that's the case then why isn't the elif statement getting executed ?
乇PIPHANY❦▧▧❄️
Evaluation is True
I may indeed need to revisited the basics
Charly
乇PIPHANY❦▧▧❄️
Probably because the if is evaluated
but it does get executed when any of the specified variable is empty
乇PIPHANY❦▧▧❄️
乇PIPHANY❦▧▧❄️
Perhaps only username(?)
no any of them email and password1 included
乇PIPHANY❦▧▧❄️
I mean you are free to ignore us
i mean, it is working but no knowledge is wasted they say
Charly
It will always be True
Charly
No matter the data there
乇PIPHANY❦▧▧❄️
乇PIPHANY❦▧▧❄️
how I wish I could share the result
Charly
😹
Well 🤷
乇PIPHANY❦▧▧❄️
in an unrelated question I want to upload my first project to github it has a database in it not like it's anything important or detrimental buh is there a safety precaution like removing the password in settings.py or no one cares?
乇PIPHANY❦▧▧❄️
Hmmm make them environment variables so they won't be included in the code Or make a file like passwords.json and include it in .gitignore
haven't the slightest idea what you mean especially the latter part for the former it was made in a virtual environment is that what you mean ?!
Mohammad Hossein
haven't the slightest idea what you mean especially the latter part for the former it was made in a virtual environment is that what you mean ?!
No I don't know how to explain environment variables but they're accessible with os.enviorn And about .gitignore, search it on google
乇PIPHANY❦▧▧❄️
乇PIPHANY❦▧▧❄️
many thanks
Disami
I was doing customuser which extends from.defualt and.in my.case i want to.generate a username which have a first 3 letters of firstname plus 123 i define a function to.generate and and call inside create user at the customusermanager the problem is in.my admin.panel it says username cant be empty how fix that any help
乇PIPHANY❦▧▧❄️
I assume it's a modelfield .. perhaps try blank = true
that's username = model.charfield(blank=true)
Disami
that's username = model.charfield(blank=true)
I did that already but i think the case is i set username _field="username" so.that the django do it's auth session others stuff ,to do so it needst username not.be.empty
Disami
Okay yea the best way will be objects=custom usermanger() to put this line before the username _feild =""and required _fields ="" i will try this one
Nithin
While setuping django >installed virtualwrapper-win > created a env > django-admin –version = runnned this cmd to check if it installed properly Result (myenvdjangocm) C:\Users\nithi>django-admin --version Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\Users\nithi\Envs\myenvdjangocm\Scripts\django-admin.exe\__main__.py", line 4, in <module> from django.core.management import execute_from_command_line File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\core\management\__init__.py", line 19, in <module> from django.core.management.base import ( ...<4 lines>... ) File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\core\management\base.py", line 14, in <module> from django.core import checks File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\core\checks\__init__.py", line 18, in <module> import django.core.checks.caches # NOQA isort:skip ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\core\checks\caches.py", line 4, in <module> from django.core.cache import DEFAULT_CACHE_ALIAS, caches File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\core\cache\__init__.py", line 67, in <module> signals.request_finished.connect(close_caches) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\dispatch\dispatcher.py", line 87, in connect if settings.configured and settings.DEBUG: ^^^^^^^^^^^^^^ File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\conf\__init__.py", line 91, in __getattr__ val = getattr(_wrapped, name) ~~~~~^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'DEBUG'
Nithin
can any one help me with this
maneliiii
While setuping django >installed virtualwrapper-win > created a env > django-admin –version = runnned this cmd to check if it installed properly Result (myenvdjangocm) C:\Users\nithi>django-admin --version Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\Users\nithi\Envs\myenvdjangocm\Scripts\django-admin.exe\__main__.py", line 4, in <module> from django.core.management import execute_from_command_line File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\core\management\__init__.py", line 19, in <module> from django.core.management.base import ( ...<4 lines>... ) File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\core\management\base.py", line 14, in <module> from django.core import checks File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\core\checks\__init__.py", line 18, in <module> import django.core.checks.caches # NOQA isort:skip ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\core\checks\caches.py", line 4, in <module> from django.core.cache import DEFAULT_CACHE_ALIAS, caches File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\core\cache\__init__.py", line 67, in <module> signals.request_finished.connect(close_caches) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\dispatch\dispatcher.py", line 87, in connect if settings.configured and settings.DEBUG: ^^^^^^^^^^^^^^ File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\conf\__init__.py", line 91, in __getattr__ val = getattr(_wrapped, name) ~~~~~^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'DEBUG'
did you activate env?
Habib
Hello there I have a question If I created a customer user extending the abstractuser Set email as USERNAME_FIELD and Required_Fields to [] empty list why it still asks for username
Habib
Even when when setting username=None
clouded
While setuping django >installed virtualwrapper-win > created a env > django-admin –version = runnned this cmd to check if it installed properly Result (myenvdjangocm) C:\Users\nithi>django-admin --version Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\Users\nithi\Envs\myenvdjangocm\Scripts\django-admin.exe\__main__.py", line 4, in <module> from django.core.management import execute_from_command_line File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\core\management\__init__.py", line 19, in <module> from django.core.management.base import ( ...<4 lines>... ) File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\core\management\base.py", line 14, in <module> from django.core import checks File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\core\checks\__init__.py", line 18, in <module> import django.core.checks.caches # NOQA isort:skip ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\core\checks\caches.py", line 4, in <module> from django.core.cache import DEFAULT_CACHE_ALIAS, caches File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\core\cache\__init__.py", line 67, in <module> signals.request_finished.connect(close_caches) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\dispatch\dispatcher.py", line 87, in connect if settings.configured and settings.DEBUG: ^^^^^^^^^^^^^^ File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\conf\__init__.py", line 91, in __getattr__ val = getattr(_wrapped, name) ~~~~~^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'DEBUG'
type(None)
Achiever’s
No one can help you until you explain your difficulties.
I want to use elasticache for my project. I setup all the things but when i am connecting with elasticache redis by command Redis-cli -h endpoint It is not giving any output Can anyone help me out
Doragonsureiyā
I want to use elasticache for my project. I setup all the things but when i am connecting with elasticache redis by command Redis-cli -h endpoint It is not giving any output Can anyone help me out
This is not a Django specific question, please delete your offtopic message. If it's a Python related question go to @Python group, otherwise please move to @PythonOfftopic group and ask there.
Minilik_muluneh
I set and get session values in the home function but when i open the web app with chrome and Microsoft edge it is the same , why?
Asyrof
Guys i have error to connect mysql databases. error says it 'cant connect to local mysql server througt socket 'var/run/mysql/mysql.sock' . Help me please😢
Ghost
how to set http404 page global to all app
️امیر
how to set http404 page global to all app
Make this file BASE_DIR/templates/404.html Then, when you set DEBUG to False, it will show up
️امیر
Thanks bro
My pleasure
Nithin
did you activate env?
Yes activated environment
Nithin
clouded
What.?
It's Python code
Kuth
While setuping django >installed virtualwrapper-win > created a env > django-admin –version = runnned this cmd to check if it installed properly Result (myenvdjangocm) C:\Users\nithi>django-admin --version Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\Users\nithi\Envs\myenvdjangocm\Scripts\django-admin.exe\__main__.py", line 4, in <module> from django.core.management import execute_from_command_line File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\core\management\__init__.py", line 19, in <module> from django.core.management.base import ( ...<4 lines>... ) File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\core\management\base.py", line 14, in <module> from django.core import checks File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\core\checks\__init__.py", line 18, in <module> import django.core.checks.caches # NOQA isort:skip ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\core\checks\caches.py", line 4, in <module> from django.core.cache import DEFAULT_CACHE_ALIAS, caches File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\core\cache\__init__.py", line 67, in <module> signals.request_finished.connect(close_caches) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\dispatch\dispatcher.py", line 87, in connect if settings.configured and settings.DEBUG: ^^^^^^^^^^^^^^ File "C:\Users\nithi\Envs\myenvdjangocm\Lib\site-packages\django\conf\__init__.py", line 91, in __getattr__ val = getattr(_wrapped, name) ~~~~~^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'DEBUG'
Ensure your env is Activated before run, and import Settings correct path
Nithin
Anv is activated and i will try import settings correct path
Asyrof
clouded
What.?
Have you run it?
Shaheen
I can't run collectstatic on django 5.0.7 getting this error : File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/core/files/storage/filesystem.py", line 116, in _save locks.unlock(fd) File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/core/files/locks.py", line 127, in unlock fcntl.flock(_fd(f), fcntl.LOCK_UN) OSError: [Errno 38] Function not implemented
park seo joon
Also try Import os
park seo joon
why ?
I can see termux on your path
Shaheen
Also try Import os
?? where settings.py
park seo joon
?? where settings.py
Yes at the top
Shaheen
Yes at the top
but I'm still getting the same error
park seo joon
but I'm still getting the same error
Did you configure the static dir and static root correctly
Shaheen
yes i did , something on the django framework, django/core/files/locks.py
Shaheen
STATIC_URL = 'static/' STATIC_ROOT = BASE_DIR / 'static' #STATICFILES_DIRS = BASE_DIR / 'static' # media files MEDIA_URL = '/media/' MEDIA_ROOT = BASE_DIR / 'media'
park seo joon
yes i did , something on the django framework, django/core/files/locks.py
And remember if you are using for production is only when you need to run collect statics and for development you don't really needs it
Shaheen
Is this how you pass it? Then it's not correct
can you please gimme the correct code ?
Shaheen
Is this how you pass it? Then it's not correct
Hey I'm getting the same error when i try to add an image on my model through the admin page
Shaheen
https://forum.djangoproject.com/t/oserror-media-upload-error/33547
park seo joon
can you please gimme the correct code ?
https://hastebin.com/share/iliyivuvov.ini
Shaheen
Mohammad Hossein
still i cant ! same OSError
Well I guess OSError should be related to OS. Try your code somewhere else
park seo joon
still i cant ! same OSError
Are you working development or your are working on production consider all those and I don't know why it's not working
park seo joon
And I don't know the kind of os error you are encountering
Shaheen
my pc got some problems so I'm just doing my college project through android termux