Changed SECRET_KEY to be randomly generated by manage.py when settings.py is first created, rather than to rely on people manually changing the default from settings_default when first starting the server.

This commit is contained in:
Griatch 2012-03-31 11:32:26 +02:00
parent 45c5be8468
commit 1ce5c6b84a
2 changed files with 81 additions and 59 deletions

View file

@ -29,6 +29,12 @@ if not os.path.exists('settings.py'):
# If settings.py doesn't already exist, create it and populate it with some
# basic stuff.
# make random secret_key.
import random, string
secret_key = list((string.letters + string.digits + string.punctuation).replace("'",'"'))
random.shuffle(secret_key)
secret_key = "".join(secret_key[:40])
settings_file = open('settings.py', 'w')
_CREATED_SETTINGS = True
@ -46,54 +52,63 @@ if not os.path.exists('settings.py'):
from src.settings_default import *
###################################################
######################################################################
# Evennia base server config
###################################################
######################################################################
###################################################
######################################################################
# Evennia Database config
###################################################
######################################################################
###################################################
######################################################################
# Evennia pluggable modules
###################################################
######################################################################
###################################################
######################################################################
# Default command sets
###################################################
######################################################################
###################################################
######################################################################
# Typeclasses
###################################################
######################################################################
###################################################
######################################################################
# Batch processors
###################################################
######################################################################
###################################################
######################################################################
# Game Time setup
###################################################
######################################################################
###################################################
######################################################################
# In-game access
###################################################
######################################################################
###################################################
######################################################################
# In-game Channels created from server start
###################################################
######################################################################
###################################################
######################################################################
# External Channel connections
###################################################
######################################################################
###################################################
######################################################################
# Config for Django web features
###################################################
######################################################################
###################################################
######################################################################
# Evennia components
###################################################
"""
######################################################################
######################################################################
# SECRET_KEY was randomly seeded when settings.py was first created.
# Don't share this with anybody. Warning: if you edit SECRET_KEY
# *after* creating any accounts, your users won't be able to login,
# since SECRET_KEY is used to salt passwords.
######################################################################
SECRET_KEY = '%s'
""" % secret_key
settings_file.write(string)
settings_file.close()