1
votes

''' File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/init.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/base.py", line 330, in run_from_argv self.execute(*args, **cmd_options) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/base.py", line 371, in execute output = self.handle(*args, **options) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/commands/startproject.py", line 18, in handle options['secret_key'] = get_random_secret_key() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/utils.py", line 82, in get_random_secret_key return get_random_string(50, chars) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/utils/crypto.py", line 74, in get_random_string return ''.join(secrets.choice(allowed_chars) for i in range(length)) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/utils/crypto.py", line 74, in return ''.join(secrets.choice(allowed_chars) for i in range(length)) AttributeError: module 'secrets' has no attribute 'choice' '''

1
Fixed it. I accidentally deleted the secrets file and put one of my secret keys as secrets.pyJonny Murillo

1 Answers

1
votes

Make sure you don't have any file or folders named secrets anywhere in your python path and/or current working directory. That may shadow the built in secrets module.