We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Exporting always downloads the same zip
**Environment**:

  - CTFd Version/Commit: 2.1.2
  - Operating System: Standard docker-compose launch on Linux
  - Web Browser and Version: Firefox 67.0.3

**What happened?**

When exporting the challenges from `/admin/config#backup`, the same zip downloads as the first export. It only contains the one challenge that was there when the backup was made, although there are around 30 challenges.

**What did you expect to happen?**

The export should download a zip file with all of the current challenges.

**How to reproduce your issue**

Export multiple times with different numbers of challenges.



--- 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/admin/__init__.py`
Content:
```
1 from flask import (
2     current_app as app,
3     render_template,
4     request,
5     redirect,
6     url_for,
7     Blueprint,
8     abort,
9     render_template_string,
10     send_file,
11 )
12 
13 from CTFd.utils.decorators import admins_only
14 from CTFd.utils.user import is_admin
15 from CTFd.utils.security.auth import logout_user
16 from CTFd.utils import config as ctf_config, get_config, set_config
17 from CTFd.cache import cache, clear_config
18 from CTFd.utils.helpers import get_errors
19 from CTFd.utils.exports import (
20     export_ctf as export_ctf_util,
21     import_ctf as import_ctf_util,
22 )
23 from CTFd.models import (
24     db,
25     get_class_by_tablename,
26     Users,
27     Teams,
28     Configs,
29     Submissions,
30     Solves,
31     Awards,
32     Unlocks,
33     Tracking,
34 )
35 import datetime
36 import os
37 import six
38 import csv
39 
40 
41 admin = Blueprint("admin", __name__)
42 
43 
44 from CTFd.admin import challenges  # noqa: F401
45 from CTFd.admin import pages  # noqa: F401
46 from CTFd.admin import scoreboard  # noqa: F401
47 from CTFd.admin import statistics  # noqa: F401
48 from CTFd.admin import teams  # noqa: F401
49 from CTFd.admin import users  # noqa: F401
50 from CTFd.admin import submissions  # noqa: F401
51 from CTFd.admin import notifications  # noqa: F401
52 
53 
54 @admin.route("/admin", methods=["GET"])
55 def view():
56     if is_admin():
57         return redirect(url_for("admin.statistics"))
58     return redirect(url_for("auth.login"))
59 
60 
61 @admin.route("/admin/plugins/<plugin>", methods=["GET", "POST"])
62 @admins_only
63 def plugin(plugin):
64     if request.method == "GET":
65         plugins_path = os.path.join(app.root_path, "plugins")
66 
67         config_html_plugins = [
68             name
69             for name in os.listdir(plugins_path)
70             if os.path.isfile(os.path.join(plugins_path, name, "config.html"))
71         ]
72 
73         if plugin in config_html_plugins:
74             config_html = open(
75                 os.path.join(app.root_path, "plugins", plugin, "config.html")
76             ).read()
77             return render_template_string(config_html)
78         abort(404)
79     elif request.method == "POST":
80         for k, v in request.form.items():
81             if k == "nonce":
82                 continue
83             set_config(k, v)
84         with app.app_context():
85             clear_config()
86         return "1"
87 
88 
89 @admin.route("/admin/import", methods=["POST"])
90 @admins_only
91 def import_ctf():
92     backup = request.files["backup"]
93     errors = get_errors()
94     try:
95         import_ctf_util(backup)
96     except Exception as e:
97         print(e)
98         errors.append(repr(e))
99 
100     if errors:
101         return errors[0], 500
102     else:
103         return redirect(url_for("admin.config"))
104 
105 
106 @admin.route("/admin/export", methods=["GET", "POST"])
107 @admins_only
108 def export_ctf():
109     backup = export_ctf_util()
110     ctf_name = ctf_config.ctf_name()
111     day = datetime.datetime.now().strftime("%Y-%m-%d")
112     full_name = u"{}.{}.zip".format(ctf_name, day)
113     return send_file(backup, as_attachment=True, attachment_filename=full_name)
114 
115 
116 @admin.route("/admin/export/csv")
117 @admins_only
118 def export_csv():
119     table = request.args.get("table")
120 
121     # TODO: It might make sense to limit dumpable tables. Config could potentially leak sensitive information.
122     model = get_class_by_tablename(table)
123     if model is None:
124         abort(404)
125 
126     output = six.StringIO()
127     writer = csv.writer(output)
128 
129     header = [column.name for column in model.__mapper__.columns]
130     writer.writerow(header)
131 
132     responses = model.query.all()
133 
134     for curr in responses:
135         writer.writerow(
136             [getattr(curr, column.name) for column in model.__mapper__.columns]
137         )
138 
139     output.seek(0)
140     return send_file(
141         output,
142         as_attachment=True,
143         cache_timeout=-1,
144         attachment_filename="{name}-{table}.csv".format(
145             name=ctf_config.ctf_name(), table=table
146         ),
147     )
148 
149 
150 @admin.route("/admin/config", methods=["GET", "POST"])
151 @admins_only
152 def config():
153     # Clear the config cache so that we don't get stale values
154     clear_config()
155 
156     database_tables = sorted(db.metadata.tables.keys())
157 
158     configs = Configs.query.all()
159     configs = dict([(c.key, get_config(c.key)) for c in configs])
160 
161     themes = ctf_config.get_themes()
162     themes.remove(get_config("ctf_theme"))
163 
164     return render_template(
165         "admin/config.html", database_tables=database_tables, themes=themes, **configs
166     )
167 
168 
169 @admin.route("/admin/reset", methods=["GET", "POST"])
170 @admins_only
171 def reset():
172     if request.method == "POST":
173         # Truncate Users, Teams, Submissions, Solves, Notifications, Awards, Unlocks, Tracking
174         Tracking.query.delete()
175         Solves.query.delete()
176         Submissions.query.delete()
177         Awards.query.delete()
178         Unlocks.query.delete()
179         Users.query.delete()
180         Teams.query.delete()
181         set_config("setup", False)
182         db.session.commit()
183         cache.clear()
184         logout_user()
185         db.session.close()
186         return redirect(url_for("views.setup"))
187 
188     return render_template("admin/reset.html")
189
```
--- 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/admin/__init__.py b/CTFd/admin/__init__.py
--- a/CTFd/admin/__init__.py
+++ b/CTFd/admin/__init__.py
@@ -110,7 +110,9 @@
     ctf_name = ctf_config.ctf_name()
     day = datetime.datetime.now().strftime("%Y-%m-%d")
     full_name = u"{}.{}.zip".format(ctf_name, day)
-    return send_file(backup, as_attachment=True, attachment_filename=full_name)
+    return send_file(
+        backup, cache_timeout=-1, as_attachment=True, attachment_filename=full_name
+    )
 
 
 @admin.route("/admin/export/csv")

{"golden_diff": "diff --git a/CTFd/admin/__init__.py b/CTFd/admin/__init__.py\n--- a/CTFd/admin/__init__.py\n+++ b/CTFd/admin/__init__.py\n@@ -110,7 +110,9 @@\n     ctf_name = ctf_config.ctf_name()\n     day = datetime.datetime.now().strftime(\"%Y-%m-%d\")\n     full_name = u\"{}.{}.zip\".format(ctf_name, day)\n-    return send_file(backup, as_attachment=True, attachment_filename=full_name)\n+    return send_file(\n+        backup, cache_timeout=-1, as_attachment=True, attachment_filename=full_name\n+    )\n \n \n @admin.route(\"/admin/export/csv\")\n", "issue": "Exporting always downloads the same zip\n**Environment**:\r\n\r\n  - CTFd Version/Commit: 2.1.2\r\n  - Operating System: Standard docker-compose launch on Linux\r\n  - Web Browser and Version: Firefox 67.0.3\r\n\r\n**What happened?**\r\n\r\nWhen exporting the challenges from `/admin/config#backup`, the same zip downloads as the first export. It only contains the one challenge that was there when the backup was made, although there are around 30 challenges.\r\n\r\n**What did you expect to happen?**\r\n\r\nThe export should download a zip file with all of the current challenges.\r\n\r\n**How to reproduce your issue**\r\n\r\nExport multiple times with different numbers of challenges.\r\n\r\n\n", "before_files": [{"content": "from flask import (\n    current_app as app,\n    render_template,\n    request,\n    redirect,\n    url_for,\n    Blueprint,\n    abort,\n    render_template_string,\n    send_file,\n)\n\nfrom CTFd.utils.decorators import admins_only\nfrom CTFd.utils.user import is_admin\nfrom CTFd.utils.security.auth import logout_user\nfrom CTFd.utils import config as ctf_config, get_config, set_config\nfrom CTFd.cache import cache, clear_config\nfrom CTFd.utils.helpers import get_errors\nfrom CTFd.utils.exports import (\n    export_ctf as export_ctf_util,\n    import_ctf as import_ctf_util,\n)\nfrom CTFd.models import (\n    db,\n    get_class_by_tablename,\n    Users,\n    Teams,\n    Configs,\n    Submissions,\n    Solves,\n    Awards,\n    Unlocks,\n    Tracking,\n)\nimport datetime\nimport os\nimport six\nimport csv\n\n\nadmin = Blueprint(\"admin\", __name__)\n\n\nfrom CTFd.admin import challenges  # noqa: F401\nfrom CTFd.admin import pages  # noqa: F401\nfrom CTFd.admin import scoreboard  # noqa: F401\nfrom CTFd.admin import statistics  # noqa: F401\nfrom CTFd.admin import teams  # noqa: F401\nfrom CTFd.admin import users  # noqa: F401\nfrom CTFd.admin import submissions  # noqa: F401\nfrom CTFd.admin import notifications  # noqa: F401\n\n\n@admin.route(\"/admin\", methods=[\"GET\"])\ndef view():\n    if is_admin():\n        return redirect(url_for(\"admin.statistics\"))\n    return redirect(url_for(\"auth.login\"))\n\n\n@admin.route(\"/admin/plugins/<plugin>\", methods=[\"GET\", \"POST\"])\n@admins_only\ndef plugin(plugin):\n    if request.method == \"GET\":\n        plugins_path = os.path.join(app.root_path, \"plugins\")\n\n        config_html_plugins = [\n            name\n            for name in os.listdir(plugins_path)\n            if os.path.isfile(os.path.join(plugins_path, name, \"config.html\"))\n        ]\n\n        if plugin in config_html_plugins:\n            config_html = open(\n                os.path.join(app.root_path, \"plugins\", plugin, \"config.html\")\n            ).read()\n            return render_template_string(config_html)\n        abort(404)\n    elif request.method == \"POST\":\n        for k, v in request.form.items():\n            if k == \"nonce\":\n                continue\n            set_config(k, v)\n        with app.app_context():\n            clear_config()\n        return \"1\"\n\n\n@admin.route(\"/admin/import\", methods=[\"POST\"])\n@admins_only\ndef import_ctf():\n    backup = request.files[\"backup\"]\n    errors = get_errors()\n    try:\n        import_ctf_util(backup)\n    except Exception as e:\n        print(e)\n        errors.append(repr(e))\n\n    if errors:\n        return errors[0], 500\n    else:\n        return redirect(url_for(\"admin.config\"))\n\n\n@admin.route(\"/admin/export\", methods=[\"GET\", \"POST\"])\n@admins_only\ndef export_ctf():\n    backup = export_ctf_util()\n    ctf_name = ctf_config.ctf_name()\n    day = datetime.datetime.now().strftime(\"%Y-%m-%d\")\n    full_name = u\"{}.{}.zip\".format(ctf_name, day)\n    return send_file(backup, as_attachment=True, attachment_filename=full_name)\n\n\n@admin.route(\"/admin/export/csv\")\n@admins_only\ndef export_csv():\n    table = request.args.get(\"table\")\n\n    # TODO: It might make sense to limit dumpable tables. Config could potentially leak sensitive information.\n    model = get_class_by_tablename(table)\n    if model is None:\n        abort(404)\n\n    output = six.StringIO()\n    writer = csv.writer(output)\n\n    header = [column.name for column in model.__mapper__.columns]\n    writer.writerow(header)\n\n    responses = model.query.all()\n\n    for curr in responses:\n        writer.writerow(\n            [getattr(curr, column.name) for column in model.__mapper__.columns]\n        )\n\n    output.seek(0)\n    return send_file(\n        output,\n        as_attachment=True,\n        cache_timeout=-1,\n        attachment_filename=\"{name}-{table}.csv\".format(\n            name=ctf_config.ctf_name(), table=table\n        ),\n    )\n\n\n@admin.route(\"/admin/config\", methods=[\"GET\", \"POST\"])\n@admins_only\ndef config():\n    # Clear the config cache so that we don't get stale values\n    clear_config()\n\n    database_tables = sorted(db.metadata.tables.keys())\n\n    configs = Configs.query.all()\n    configs = dict([(c.key, get_config(c.key)) for c in configs])\n\n    themes = ctf_config.get_themes()\n    themes.remove(get_config(\"ctf_theme\"))\n\n    return render_template(\n        \"admin/config.html\", database_tables=database_tables, themes=themes, **configs\n    )\n\n\n@admin.route(\"/admin/reset\", methods=[\"GET\", \"POST\"])\n@admins_only\ndef reset():\n    if request.method == \"POST\":\n        # Truncate Users, Teams, Submissions, Solves, Notifications, Awards, Unlocks, Tracking\n        Tracking.query.delete()\n        Solves.query.delete()\n        Submissions.query.delete()\n        Awards.query.delete()\n        Unlocks.query.delete()\n        Users.query.delete()\n        Teams.query.delete()\n        set_config(\"setup\", False)\n        db.session.commit()\n        cache.clear()\n        logout_user()\n        db.session.close()\n        return redirect(url_for(\"views.setup\"))\n\n    return render_template(\"admin/reset.html\")\n", "path": "CTFd/admin/__init__.py"}], "after_files": [{"content": "from flask import (\n    current_app as app,\n    render_template,\n    request,\n    redirect,\n    url_for,\n    Blueprint,\n    abort,\n    render_template_string,\n    send_file,\n)\n\nfrom CTFd.utils.decorators import admins_only\nfrom CTFd.utils.user import is_admin\nfrom CTFd.utils.security.auth import logout_user\nfrom CTFd.utils import config as ctf_config, get_config, set_config\nfrom CTFd.cache import cache, clear_config\nfrom CTFd.utils.helpers import get_errors\nfrom CTFd.utils.exports import (\n    export_ctf as export_ctf_util,\n    import_ctf as import_ctf_util,\n)\nfrom CTFd.models import (\n    db,\n    get_class_by_tablename,\n    Users,\n    Teams,\n    Configs,\n    Submissions,\n    Solves,\n    Awards,\n    Unlocks,\n    Tracking,\n)\nimport datetime\nimport os\nimport six\nimport csv\n\n\nadmin = Blueprint(\"admin\", __name__)\n\n\nfrom CTFd.admin import challenges  # noqa: F401\nfrom CTFd.admin import pages  # noqa: F401\nfrom CTFd.admin import scoreboard  # noqa: F401\nfrom CTFd.admin import statistics  # noqa: F401\nfrom CTFd.admin import teams  # noqa: F401\nfrom CTFd.admin import users  # noqa: F401\nfrom CTFd.admin import submissions  # noqa: F401\nfrom CTFd.admin import notifications  # noqa: F401\n\n\n@admin.route(\"/admin\", methods=[\"GET\"])\ndef view():\n    if is_admin():\n        return redirect(url_for(\"admin.statistics\"))\n    return redirect(url_for(\"auth.login\"))\n\n\n@admin.route(\"/admin/plugins/<plugin>\", methods=[\"GET\", \"POST\"])\n@admins_only\ndef plugin(plugin):\n    if request.method == \"GET\":\n        plugins_path = os.path.join(app.root_path, \"plugins\")\n\n        config_html_plugins = [\n            name\n            for name in os.listdir(plugins_path)\n            if os.path.isfile(os.path.join(plugins_path, name, \"config.html\"))\n        ]\n\n        if plugin in config_html_plugins:\n            config_html = open(\n                os.path.join(app.root_path, \"plugins\", plugin, \"config.html\")\n            ).read()\n            return render_template_string(config_html)\n        abort(404)\n    elif request.method == \"POST\":\n        for k, v in request.form.items():\n            if k == \"nonce\":\n                continue\n            set_config(k, v)\n        with app.app_context():\n            clear_config()\n        return \"1\"\n\n\n@admin.route(\"/admin/import\", methods=[\"POST\"])\n@admins_only\ndef import_ctf():\n    backup = request.files[\"backup\"]\n    errors = get_errors()\n    try:\n        import_ctf_util(backup)\n    except Exception as e:\n        print(e)\n        errors.append(repr(e))\n\n    if errors:\n        return errors[0], 500\n    else:\n        return redirect(url_for(\"admin.config\"))\n\n\n@admin.route(\"/admin/export\", methods=[\"GET\", \"POST\"])\n@admins_only\ndef export_ctf():\n    backup = export_ctf_util()\n    ctf_name = ctf_config.ctf_name()\n    day = datetime.datetime.now().strftime(\"%Y-%m-%d\")\n    full_name = u\"{}.{}.zip\".format(ctf_name, day)\n    return send_file(\n        backup, cache_timeout=-1, as_attachment=True, attachment_filename=full_name\n    )\n\n\n@admin.route(\"/admin/export/csv\")\n@admins_only\ndef export_csv():\n    table = request.args.get(\"table\")\n\n    # TODO: It might make sense to limit dumpable tables. Config could potentially leak sensitive information.\n    model = get_class_by_tablename(table)\n    if model is None:\n        abort(404)\n\n    output = six.StringIO()\n    writer = csv.writer(output)\n\n    header = [column.name for column in model.__mapper__.columns]\n    writer.writerow(header)\n\n    responses = model.query.all()\n\n    for curr in responses:\n        writer.writerow(\n            [getattr(curr, column.name) for column in model.__mapper__.columns]\n        )\n\n    output.seek(0)\n    return send_file(\n        output,\n        as_attachment=True,\n        cache_timeout=-1,\n        attachment_filename=\"{name}-{table}.csv\".format(\n            name=ctf_config.ctf_name(), table=table\n        ),\n    )\n\n\n@admin.route(\"/admin/config\", methods=[\"GET\", \"POST\"])\n@admins_only\ndef config():\n    # Clear the config cache so that we don't get stale values\n    clear_config()\n\n    database_tables = sorted(db.metadata.tables.keys())\n\n    configs = Configs.query.all()\n    configs = dict([(c.key, get_config(c.key)) for c in configs])\n\n    themes = ctf_config.get_themes()\n    themes.remove(get_config(\"ctf_theme\"))\n\n    return render_template(\n        \"admin/config.html\", database_tables=database_tables, themes=themes, **configs\n    )\n\n\n@admin.route(\"/admin/reset\", methods=[\"GET\", \"POST\"])\n@admins_only\ndef reset():\n    if request.method == \"POST\":\n        # Truncate Users, Teams, Submissions, Solves, Notifications, Awards, Unlocks, Tracking\n        Tracking.query.delete()\n        Solves.query.delete()\n        Submissions.query.delete()\n        Awards.query.delete()\n        Unlocks.query.delete()\n        Users.query.delete()\n        Teams.query.delete()\n        set_config(\"setup\", False)\n        db.session.commit()\n        cache.clear()\n        logout_user()\n        db.session.close()\n        return redirect(url_for(\"views.setup\"))\n\n    return render_template(\"admin/reset.html\")\n", "path": "CTFd/admin/__init__.py"}]}