Django Secret Key Generator

An Alfred Workflow


Short Description

Generates a new random string suitable for use as a SECRET_KEY in Django apps

Last Updated

24 Sep 2014

Compatibility

Yosemite
(10.10)
Mavericks
(10.9)
Mountain Lion
(10.8)
Lion
(10.7)
Snow Leopard
(10.6)
Yes Yes Yes Yes Yes
 

Version

1.0
 

Bundle ID

net.tyndyll.django-secret-key
 

Author

Categories

I was working on a Django app where the source was going onto Github. The Django documentation is fairly explicit about how this key should be kept

"Keep this value secret.

Running Django with a known SECRET_KEY defeats many of Django’s security protections, and can lead to privilege escalation and remote code execution vulnerabilities."

I had the option of going online and generating a key but I thought it would be as handy to generate my own locally (connectivity being what it is in rural Ireland). To do this I've set up a shortcut Cmd + Shift + J to call a script that uses the same code as django-admin.py to generate a random string. The output is raised in a notification and copied to the clipboard

NOTE: This workflow contains code used in the Django Project and as such the following license needs to be appended:

Copyright (c) Django Software Foundation and individual contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of Django nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  

Screenshots