diff --git a/CTFd/__init__.py b/CTFd/__init__.py index fe88ea55..50f936aa 100644 --- a/CTFd/__init__.py +++ b/CTFd/__init__.py @@ -7,7 +7,7 @@ from sqlalchemy.engine.url import make_url from sqlalchemy.exc import OperationalError, ProgrammingError from sqlalchemy_utils import database_exists, create_database -from utils import get_config, set_config, cache, migrate, migrate_upgrade +from CTFd.utils import get_config, set_config, cache, migrate, migrate_upgrade __version__ = '1.0.0' diff --git a/CTFd/config.py b/CTFd/config.py index 3261e445..e6d6ff0f 100644 --- a/CTFd/config.py +++ b/CTFd/config.py @@ -2,7 +2,7 @@ import os ##### GENERATE SECRET KEY ##### -with open('.ctfd_secret_key', 'a+') as secret: +with open('.ctfd_secret_key', 'a+b') as secret: secret.seek(0) # Seek to beginning of file since a+ mode leaves you at the end and w+ deletes the file key = secret.read() if not key: @@ -23,7 +23,7 @@ class Config(object): http://flask.pocoo.org/docs/0.11/quickstart/#sessions ''' - SECRET_KEY = key + SECRET_KEY = os.environ.get('SECRET_KEY') or key ''' diff --git a/CTFd/models.py b/CTFd/models.py index 440267ae..7248c065 100644 --- a/CTFd/models.py +++ b/CTFd/models.py @@ -10,7 +10,7 @@ from sqlalchemy.exc import DatabaseError def sha512(string): - return hashlib.sha512(string).hexdigest() + return str(hashlib.sha512(string).hexdigest()) def ip2long(ip): diff --git a/CTFd/plugins/__init__.py b/CTFd/plugins/__init__.py index 1a8a4fbd..39508e89 100644 --- a/CTFd/plugins/__init__.py +++ b/CTFd/plugins/__init__.py @@ -5,7 +5,7 @@ import os def init_plugins(app): modules = glob.glob(os.path.dirname(__file__) + "/*") - blacklist = {'keys', 'challenges'} + blacklist = {'keys', 'challenges', '__pycache__'} for module in modules: module_name = os.path.basename(module) if os.path.isdir(module) and module_name not in blacklist: