Enter a key comment, which will identify the key (useful when you use several SSH keys). Generate ssh public key with putty You will be asked for it when you connect via SSH. Type in the passphrase and confirm it. The passphrase is used to protect your key.

  1. Django Secret Key
  2. Django Generate New Secret Key Switch

Using an online service to generate one is a bad idea - nobody else should ever have your secret key. How do you generate a new secret key? The otherwise-excellent Django docs are silent on this. Here's how Django generates one when you run startproject:. Hiding my SECRETKEY in settings.py Hi newbie developer here. I was pushing my project onto github when I realized that I should probably create a separate file secretsettings.py that holds my secret key and then import that variable through a line like.

Django
Django Secret Key Setting
Django
>python manage.py runserver
Traceback (most recent call last):
File 'manage.py', line 8, in <module>
execute_from_command_line(sys.argv)
File '//anaconda/lib/python2.7/site-packages/django/core/management/__init__.py', line 399, in execute_from_command_line
utility.execute()
File '//anaconda/lib/python2.7/site-packages/django/core/management/__init__.py', line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File '//anaconda/lib/python2.7/site-packages/django/core/management/base.py', line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File '//anaconda/lib/python2.7/site-packages/django/core/management/base.py', line 279, in execute
saved_locale = translation.get_language()
File '//anaconda/lib/python2.7/site-packages/django/utils/translation/__init__.py', line 154, in get_language
return _trans.get_language()
File '//anaconda/lib/python2.7/site-packages/django/utils/translation/__init__.py', line 52, in __getattr__
if settings.USE_I18N:
File '//anaconda/lib/python2.7/site-packages/django/conf/__init__.py', line 54, in __getattr__
self._setup(name)
File '//anaconda/lib/python2.7/site-packages/django/conf/__init__.py', line 49, in _setup
self._wrapped = Settings(settings_module)
File '//anaconda/lib/python2.7/site-packages/django/conf/__init__.py', line 151, in __init__
raise ImproperlyConfigured('The SECRET_KEY setting must not be empty.')
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

commented Nov 8, 2016
edited

Django Secret Key

Solution of the problem Just like the error says, you have no SECRET_KEY defined. You need to add one to your settings.py.
Django will refuse to start if SECRET_KEY is not set.
You can read more about this setting in the docs.

The SECRET_KEY can be just about anything..but if you want to use Django to generate one, you can do the following from the python shell:

from django.utils.crypto import get_random_string
chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
SECRET_KEY = get_random_string(50, chars)
print SECRET_KEY

Copy the SECRET_KEY to your settings file.

Django Generate New Secret Key Switch

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment