We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
get_config return default
get_config(key) should probably be get_config(key, default=None). This helps in some ideas where you want to do different behavior if get_config returns None. 

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `CTFd/__init__.py`
Content:
```
1 import sys
2 import os
3 
4 from distutils.version import StrictVersion
5 from flask import Flask, Request
6 from werkzeug.utils import cached_property
7 from werkzeug.contrib.fixers import ProxyFix
8 from jinja2 import FileSystemLoader
9 from jinja2.sandbox import SandboxedEnvironment
10 from six.moves import input
11 
12 from CTFd import utils
13 from CTFd.utils.migrations import migrations, migrate, upgrade, stamp, create_database
14 from CTFd.utils.sessions import CachingSessionInterface
15 from CTFd.utils.updates import update_check
16 from CTFd.utils.initialization import init_request_processors, init_template_filters, init_template_globals, init_logs
17 from CTFd.utils.events import socketio
18 from CTFd.plugins import init_plugins
19 
20 # Hack to support Unicode in Python 2 properly
21 if sys.version_info[0] < 3:
22     reload(sys)
23     sys.setdefaultencoding("utf-8")
24 
25 __version__ = '2.0.3'
26 
27 
28 class CTFdRequest(Request):
29     @cached_property
30     def path(self):
31         """
32         Hijack the original Flask request path because it does not account for subdirectory deployments in an intuitive
33         manner. We append script_root so that the path always points to the full path as seen in the browser.
34         e.g. /subdirectory/path/route vs /path/route
35 
36         :return: string
37         """
38         return self.script_root + super(CTFdRequest, self).path
39 
40 
41 class CTFdFlask(Flask):
42     def __init__(self, *args, **kwargs):
43         """Overriden Jinja constructor setting a custom jinja_environment"""
44         self.jinja_environment = SandboxedBaseEnvironment
45         self.session_interface = CachingSessionInterface(key_prefix='session')
46         self.request_class = CTFdRequest
47         Flask.__init__(self, *args, **kwargs)
48 
49     def create_jinja_environment(self):
50         """Overridden jinja environment constructor"""
51         return super(CTFdFlask, self).create_jinja_environment()
52 
53 
54 class SandboxedBaseEnvironment(SandboxedEnvironment):
55     """SandboxEnvironment that mimics the Flask BaseEnvironment"""
56     def __init__(self, app, **options):
57         if 'loader' not in options:
58             options['loader'] = app.create_global_jinja_loader()
59         # Disable cache entirely so that themes can be switched (#662)
60         # If the cache is enabled, switching themes will cause odd rendering errors
61         SandboxedEnvironment.__init__(self, cache_size=0, **options)
62         self.app = app
63 
64 
65 class ThemeLoader(FileSystemLoader):
66     """Custom FileSystemLoader that switches themes based on the configuration value"""
67     def __init__(self, searchpath, encoding='utf-8', followlinks=False):
68         super(ThemeLoader, self).__init__(searchpath, encoding, followlinks)
69         self.overriden_templates = {}
70 
71     def get_source(self, environment, template):
72         # Check if the template has been overriden
73         if template in self.overriden_templates:
74             return self.overriden_templates[template], template, True
75 
76         # Check if the template requested is for the admin panel
77         if template.startswith('admin/'):
78             template = template[6:]  # Strip out admin/
79             template = "/".join(['admin', 'templates', template])
80             return super(ThemeLoader, self).get_source(environment, template)
81 
82         # Load regular theme data
83         theme = utils.get_config('ctf_theme')
84         template = "/".join([theme, 'templates', template])
85         return super(ThemeLoader, self).get_source(environment, template)
86 
87 
88 def confirm_upgrade():
89     if sys.stdin.isatty():
90         print("/*\\ CTFd has updated and must update the database! /*\\")
91         print("/*\\ Please backup your database before proceeding! /*\\")
92         print("/*\\ CTFd maintainers are not responsible for any data loss! /*\\")
93         if input('Run database migrations (Y/N)').lower().strip() == 'y':
94             return True
95         else:
96             print('/*\\ Ignored database migrations... /*\\')
97             return False
98     else:
99         return True
100 
101 
102 def run_upgrade():
103     upgrade()
104     utils.set_config('ctf_version', __version__)
105 
106 
107 def create_app(config='CTFd.config.Config'):
108     app = CTFdFlask(__name__)
109     with app.app_context():
110         app.config.from_object(config)
111 
112         theme_loader = ThemeLoader(os.path.join(app.root_path, 'themes'), followlinks=True)
113         app.jinja_loader = theme_loader
114 
115         from CTFd.models import db, Teams, Solves, Challenges, Fails, Flags, Tags, Files, Tracking
116 
117         url = create_database()
118 
119         # This allows any changes to the SQLALCHEMY_DATABASE_URI to get pushed back in
120         # This is mostly so we can force MySQL's charset
121         app.config['SQLALCHEMY_DATABASE_URI'] = str(url)
122 
123         # Register database
124         db.init_app(app)
125 
126         # Register Flask-Migrate
127         migrations.init_app(app, db)
128 
129         # Alembic sqlite support is lacking so we should just create_all anyway
130         if url.drivername.startswith('sqlite'):
131             db.create_all()
132             stamp()
133         else:
134             # This creates tables instead of db.create_all()
135             # Allows migrations to happen properly
136             upgrade()
137 
138         from CTFd.models import ma
139 
140         ma.init_app(app)
141 
142         app.db = db
143         app.VERSION = __version__
144 
145         from CTFd.cache import cache
146 
147         cache.init_app(app)
148         app.cache = cache
149 
150         # If you have multiple workers you must have a shared cache
151         socketio.init_app(
152             app,
153             async_mode=app.config.get('SOCKETIO_ASYNC_MODE'),
154             message_queue=app.config.get('CACHE_REDIS_URL')
155         )
156 
157         if app.config.get('REVERSE_PROXY'):
158             app.wsgi_app = ProxyFix(app.wsgi_app)
159 
160         version = utils.get_config('ctf_version')
161 
162         # Upgrading from an older version of CTFd
163         if version and (StrictVersion(version) < StrictVersion(__version__)):
164             if confirm_upgrade():
165                 run_upgrade()
166             else:
167                 exit()
168 
169         if not version:
170             utils.set_config('ctf_version', __version__)
171 
172         if not utils.get_config('ctf_theme'):
173             utils.set_config('ctf_theme', 'core')
174 
175         update_check(force=True)
176 
177         init_request_processors(app)
178         init_template_filters(app)
179         init_template_globals(app)
180 
181         # Importing here allows tests to use sensible names (e.g. api instead of api_bp)
182         from CTFd.views import views
183         from CTFd.teams import teams
184         from CTFd.users import users
185         from CTFd.challenges import challenges
186         from CTFd.scoreboard import scoreboard
187         from CTFd.auth import auth
188         from CTFd.admin import admin
189         from CTFd.api import api
190         from CTFd.events import events
191         from CTFd.errors import page_not_found, forbidden, general_error, gateway_error
192 
193         app.register_blueprint(views)
194         app.register_blueprint(teams)
195         app.register_blueprint(users)
196         app.register_blueprint(challenges)
197         app.register_blueprint(scoreboard)
198         app.register_blueprint(auth)
199         app.register_blueprint(api)
200         app.register_blueprint(events)
201 
202         app.register_blueprint(admin)
203 
204         app.register_error_handler(404, page_not_found)
205         app.register_error_handler(403, forbidden)
206         app.register_error_handler(500, general_error)
207         app.register_error_handler(502, gateway_error)
208 
209         init_logs(app)
210         init_plugins(app)
211 
212         return app
213
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/CTFd/__init__.py b/CTFd/__init__.py
--- a/CTFd/__init__.py
+++ b/CTFd/__init__.py
@@ -22,7 +22,7 @@
     reload(sys)
     sys.setdefaultencoding("utf-8")
 
-__version__ = '2.0.3'
+__version__ = '2.0.4'
 
 
 class CTFdRequest(Request):

{"golden_diff": "diff --git a/CTFd/__init__.py b/CTFd/__init__.py\n--- a/CTFd/__init__.py\n+++ b/CTFd/__init__.py\n@@ -22,7 +22,7 @@\n     reload(sys)\n     sys.setdefaultencoding(\"utf-8\")\n \n-__version__ = '2.0.3'\n+__version__ = '2.0.4'\n \n \n class CTFdRequest(Request):\n", "issue": "get_config return default\nget_config(key) should probably be get_config(key, default=None). This helps in some ideas where you want to do different behavior if get_config returns None. \n", "before_files": [{"content": "import sys\nimport os\n\nfrom distutils.version import StrictVersion\nfrom flask import Flask, Request\nfrom werkzeug.utils import cached_property\nfrom werkzeug.contrib.fixers import ProxyFix\nfrom jinja2 import FileSystemLoader\nfrom jinja2.sandbox import SandboxedEnvironment\nfrom six.moves import input\n\nfrom CTFd import utils\nfrom CTFd.utils.migrations import migrations, migrate, upgrade, stamp, create_database\nfrom CTFd.utils.sessions import CachingSessionInterface\nfrom CTFd.utils.updates import update_check\nfrom CTFd.utils.initialization import init_request_processors, init_template_filters, init_template_globals, init_logs\nfrom CTFd.utils.events import socketio\nfrom CTFd.plugins import init_plugins\n\n# Hack to support Unicode in Python 2 properly\nif sys.version_info[0] < 3:\n    reload(sys)\n    sys.setdefaultencoding(\"utf-8\")\n\n__version__ = '2.0.3'\n\n\nclass CTFdRequest(Request):\n    @cached_property\n    def path(self):\n        \"\"\"\n        Hijack the original Flask request path because it does not account for subdirectory deployments in an intuitive\n        manner. We append script_root so that the path always points to the full path as seen in the browser.\n        e.g. /subdirectory/path/route vs /path/route\n\n        :return: string\n        \"\"\"\n        return self.script_root + super(CTFdRequest, self).path\n\n\nclass CTFdFlask(Flask):\n    def __init__(self, *args, **kwargs):\n        \"\"\"Overriden Jinja constructor setting a custom jinja_environment\"\"\"\n        self.jinja_environment = SandboxedBaseEnvironment\n        self.session_interface = CachingSessionInterface(key_prefix='session')\n        self.request_class = CTFdRequest\n        Flask.__init__(self, *args, **kwargs)\n\n    def create_jinja_environment(self):\n        \"\"\"Overridden jinja environment constructor\"\"\"\n        return super(CTFdFlask, self).create_jinja_environment()\n\n\nclass SandboxedBaseEnvironment(SandboxedEnvironment):\n    \"\"\"SandboxEnvironment that mimics the Flask BaseEnvironment\"\"\"\n    def __init__(self, app, **options):\n        if 'loader' not in options:\n            options['loader'] = app.create_global_jinja_loader()\n        # Disable cache entirely so that themes can be switched (#662)\n        # If the cache is enabled, switching themes will cause odd rendering errors\n        SandboxedEnvironment.__init__(self, cache_size=0, **options)\n        self.app = app\n\n\nclass ThemeLoader(FileSystemLoader):\n    \"\"\"Custom FileSystemLoader that switches themes based on the configuration value\"\"\"\n    def __init__(self, searchpath, encoding='utf-8', followlinks=False):\n        super(ThemeLoader, self).__init__(searchpath, encoding, followlinks)\n        self.overriden_templates = {}\n\n    def get_source(self, environment, template):\n        # Check if the template has been overriden\n        if template in self.overriden_templates:\n            return self.overriden_templates[template], template, True\n\n        # Check if the template requested is for the admin panel\n        if template.startswith('admin/'):\n            template = template[6:]  # Strip out admin/\n            template = \"/\".join(['admin', 'templates', template])\n            return super(ThemeLoader, self).get_source(environment, template)\n\n        # Load regular theme data\n        theme = utils.get_config('ctf_theme')\n        template = \"/\".join([theme, 'templates', template])\n        return super(ThemeLoader, self).get_source(environment, template)\n\n\ndef confirm_upgrade():\n    if sys.stdin.isatty():\n        print(\"/*\\\\ CTFd has updated and must update the database! /*\\\\\")\n        print(\"/*\\\\ Please backup your database before proceeding! /*\\\\\")\n        print(\"/*\\\\ CTFd maintainers are not responsible for any data loss! /*\\\\\")\n        if input('Run database migrations (Y/N)').lower().strip() == 'y':\n            return True\n        else:\n            print('/*\\\\ Ignored database migrations... /*\\\\')\n            return False\n    else:\n        return True\n\n\ndef run_upgrade():\n    upgrade()\n    utils.set_config('ctf_version', __version__)\n\n\ndef create_app(config='CTFd.config.Config'):\n    app = CTFdFlask(__name__)\n    with app.app_context():\n        app.config.from_object(config)\n\n        theme_loader = ThemeLoader(os.path.join(app.root_path, 'themes'), followlinks=True)\n        app.jinja_loader = theme_loader\n\n        from CTFd.models import db, Teams, Solves, Challenges, Fails, Flags, Tags, Files, Tracking\n\n        url = create_database()\n\n        # This allows any changes to the SQLALCHEMY_DATABASE_URI to get pushed back in\n        # This is mostly so we can force MySQL's charset\n        app.config['SQLALCHEMY_DATABASE_URI'] = str(url)\n\n        # Register database\n        db.init_app(app)\n\n        # Register Flask-Migrate\n        migrations.init_app(app, db)\n\n        # Alembic sqlite support is lacking so we should just create_all anyway\n        if url.drivername.startswith('sqlite'):\n            db.create_all()\n            stamp()\n        else:\n            # This creates tables instead of db.create_all()\n            # Allows migrations to happen properly\n            upgrade()\n\n        from CTFd.models import ma\n\n        ma.init_app(app)\n\n        app.db = db\n        app.VERSION = __version__\n\n        from CTFd.cache import cache\n\n        cache.init_app(app)\n        app.cache = cache\n\n        # If you have multiple workers you must have a shared cache\n        socketio.init_app(\n            app,\n            async_mode=app.config.get('SOCKETIO_ASYNC_MODE'),\n            message_queue=app.config.get('CACHE_REDIS_URL')\n        )\n\n        if app.config.get('REVERSE_PROXY'):\n            app.wsgi_app = ProxyFix(app.wsgi_app)\n\n        version = utils.get_config('ctf_version')\n\n        # Upgrading from an older version of CTFd\n        if version and (StrictVersion(version) < StrictVersion(__version__)):\n            if confirm_upgrade():\n                run_upgrade()\n            else:\n                exit()\n\n        if not version:\n            utils.set_config('ctf_version', __version__)\n\n        if not utils.get_config('ctf_theme'):\n            utils.set_config('ctf_theme', 'core')\n\n        update_check(force=True)\n\n        init_request_processors(app)\n        init_template_filters(app)\n        init_template_globals(app)\n\n        # Importing here allows tests to use sensible names (e.g. api instead of api_bp)\n        from CTFd.views import views\n        from CTFd.teams import teams\n        from CTFd.users import users\n        from CTFd.challenges import challenges\n        from CTFd.scoreboard import scoreboard\n        from CTFd.auth import auth\n        from CTFd.admin import admin\n        from CTFd.api import api\n        from CTFd.events import events\n        from CTFd.errors import page_not_found, forbidden, general_error, gateway_error\n\n        app.register_blueprint(views)\n        app.register_blueprint(teams)\n        app.register_blueprint(users)\n        app.register_blueprint(challenges)\n        app.register_blueprint(scoreboard)\n        app.register_blueprint(auth)\n        app.register_blueprint(api)\n        app.register_blueprint(events)\n\n        app.register_blueprint(admin)\n\n        app.register_error_handler(404, page_not_found)\n        app.register_error_handler(403, forbidden)\n        app.register_error_handler(500, general_error)\n        app.register_error_handler(502, gateway_error)\n\n        init_logs(app)\n        init_plugins(app)\n\n        return app\n", "path": "CTFd/__init__.py"}], "after_files": [{"content": "import sys\nimport os\n\nfrom distutils.version import StrictVersion\nfrom flask import Flask, Request\nfrom werkzeug.utils import cached_property\nfrom werkzeug.contrib.fixers import ProxyFix\nfrom jinja2 import FileSystemLoader\nfrom jinja2.sandbox import SandboxedEnvironment\nfrom six.moves import input\n\nfrom CTFd import utils\nfrom CTFd.utils.migrations import migrations, migrate, upgrade, stamp, create_database\nfrom CTFd.utils.sessions import CachingSessionInterface\nfrom CTFd.utils.updates import update_check\nfrom CTFd.utils.initialization import init_request_processors, init_template_filters, init_template_globals, init_logs\nfrom CTFd.utils.events import socketio\nfrom CTFd.plugins import init_plugins\n\n# Hack to support Unicode in Python 2 properly\nif sys.version_info[0] < 3:\n    reload(sys)\n    sys.setdefaultencoding(\"utf-8\")\n\n__version__ = '2.0.4'\n\n\nclass CTFdRequest(Request):\n    @cached_property\n    def path(self):\n        \"\"\"\n        Hijack the original Flask request path because it does not account for subdirectory deployments in an intuitive\n        manner. We append script_root so that the path always points to the full path as seen in the browser.\n        e.g. /subdirectory/path/route vs /path/route\n\n        :return: string\n        \"\"\"\n        return self.script_root + super(CTFdRequest, self).path\n\n\nclass CTFdFlask(Flask):\n    def __init__(self, *args, **kwargs):\n        \"\"\"Overriden Jinja constructor setting a custom jinja_environment\"\"\"\n        self.jinja_environment = SandboxedBaseEnvironment\n        self.session_interface = CachingSessionInterface(key_prefix='session')\n        self.request_class = CTFdRequest\n        Flask.__init__(self, *args, **kwargs)\n\n    def create_jinja_environment(self):\n        \"\"\"Overridden jinja environment constructor\"\"\"\n        return super(CTFdFlask, self).create_jinja_environment()\n\n\nclass SandboxedBaseEnvironment(SandboxedEnvironment):\n    \"\"\"SandboxEnvironment that mimics the Flask BaseEnvironment\"\"\"\n    def __init__(self, app, **options):\n        if 'loader' not in options:\n            options['loader'] = app.create_global_jinja_loader()\n        # Disable cache entirely so that themes can be switched (#662)\n        # If the cache is enabled, switching themes will cause odd rendering errors\n        SandboxedEnvironment.__init__(self, cache_size=0, **options)\n        self.app = app\n\n\nclass ThemeLoader(FileSystemLoader):\n    \"\"\"Custom FileSystemLoader that switches themes based on the configuration value\"\"\"\n    def __init__(self, searchpath, encoding='utf-8', followlinks=False):\n        super(ThemeLoader, self).__init__(searchpath, encoding, followlinks)\n        self.overriden_templates = {}\n\n    def get_source(self, environment, template):\n        # Check if the template has been overriden\n        if template in self.overriden_templates:\n            return self.overriden_templates[template], template, True\n\n        # Check if the template requested is for the admin panel\n        if template.startswith('admin/'):\n            template = template[6:]  # Strip out admin/\n            template = \"/\".join(['admin', 'templates', template])\n            return super(ThemeLoader, self).get_source(environment, template)\n\n        # Load regular theme data\n        theme = utils.get_config('ctf_theme')\n        template = \"/\".join([theme, 'templates', template])\n        return super(ThemeLoader, self).get_source(environment, template)\n\n\ndef confirm_upgrade():\n    if sys.stdin.isatty():\n        print(\"/*\\\\ CTFd has updated and must update the database! /*\\\\\")\n        print(\"/*\\\\ Please backup your database before proceeding! /*\\\\\")\n        print(\"/*\\\\ CTFd maintainers are not responsible for any data loss! /*\\\\\")\n        if input('Run database migrations (Y/N)').lower().strip() == 'y':\n            return True\n        else:\n            print('/*\\\\ Ignored database migrations... /*\\\\')\n            return False\n    else:\n        return True\n\n\ndef run_upgrade():\n    upgrade()\n    utils.set_config('ctf_version', __version__)\n\n\ndef create_app(config='CTFd.config.Config'):\n    app = CTFdFlask(__name__)\n    with app.app_context():\n        app.config.from_object(config)\n\n        theme_loader = ThemeLoader(os.path.join(app.root_path, 'themes'), followlinks=True)\n        app.jinja_loader = theme_loader\n\n        from CTFd.models import db, Teams, Solves, Challenges, Fails, Flags, Tags, Files, Tracking\n\n        url = create_database()\n\n        # This allows any changes to the SQLALCHEMY_DATABASE_URI to get pushed back in\n        # This is mostly so we can force MySQL's charset\n        app.config['SQLALCHEMY_DATABASE_URI'] = str(url)\n\n        # Register database\n        db.init_app(app)\n\n        # Register Flask-Migrate\n        migrations.init_app(app, db)\n\n        # Alembic sqlite support is lacking so we should just create_all anyway\n        if url.drivername.startswith('sqlite'):\n            db.create_all()\n            stamp()\n        else:\n            # This creates tables instead of db.create_all()\n            # Allows migrations to happen properly\n            upgrade()\n\n        from CTFd.models import ma\n\n        ma.init_app(app)\n\n        app.db = db\n        app.VERSION = __version__\n\n        from CTFd.cache import cache\n\n        cache.init_app(app)\n        app.cache = cache\n\n        # If you have multiple workers you must have a shared cache\n        socketio.init_app(\n            app,\n            async_mode=app.config.get('SOCKETIO_ASYNC_MODE'),\n            message_queue=app.config.get('CACHE_REDIS_URL')\n        )\n\n        if app.config.get('REVERSE_PROXY'):\n            app.wsgi_app = ProxyFix(app.wsgi_app)\n\n        version = utils.get_config('ctf_version')\n\n        # Upgrading from an older version of CTFd\n        if version and (StrictVersion(version) < StrictVersion(__version__)):\n            if confirm_upgrade():\n                run_upgrade()\n            else:\n                exit()\n\n        if not version:\n            utils.set_config('ctf_version', __version__)\n\n        if not utils.get_config('ctf_theme'):\n            utils.set_config('ctf_theme', 'core')\n\n        update_check(force=True)\n\n        init_request_processors(app)\n        init_template_filters(app)\n        init_template_globals(app)\n\n        # Importing here allows tests to use sensible names (e.g. api instead of api_bp)\n        from CTFd.views import views\n        from CTFd.teams import teams\n        from CTFd.users import users\n        from CTFd.challenges import challenges\n        from CTFd.scoreboard import scoreboard\n        from CTFd.auth import auth\n        from CTFd.admin import admin\n        from CTFd.api import api\n        from CTFd.events import events\n        from CTFd.errors import page_not_found, forbidden, general_error, gateway_error\n\n        app.register_blueprint(views)\n        app.register_blueprint(teams)\n        app.register_blueprint(users)\n        app.register_blueprint(challenges)\n        app.register_blueprint(scoreboard)\n        app.register_blueprint(auth)\n        app.register_blueprint(api)\n        app.register_blueprint(events)\n\n        app.register_blueprint(admin)\n\n        app.register_error_handler(404, page_not_found)\n        app.register_error_handler(403, forbidden)\n        app.register_error_handler(500, general_error)\n        app.register_error_handler(502, gateway_error)\n\n        init_logs(app)\n        init_plugins(app)\n\n        return app\n", "path": "CTFd/__init__.py"}]}