How to upgrade?

Hi, is there any procedure on how to upgrade self hosted CTFd ? Can’t find any information on that

There are several ways to update CTFd when it is self hosted. They mostly depend on how you have your CTFd instance setup.

One option is to use the export feature that CTFd provides and export all of the data with your instance. From there you can blow your existing instance away (delete everything) and then redeploy the latest version of CTFd. Following that, you can then use the import features to import your config that you had previously.

The other option that you have is to shutdown CTFd, run git pull and then start CTFd up again.

thx I appreciate it !

Hi, will both options keep all the configs, user and challenge info? Thanks

Hi, Sorry to revive an older thread. I had a CTFd server running 3.0.0. I’ve made an export and now I try to import it in the version 3.3.0. I get errors and the import is not working.


Can you tell me how I can run my CTF with all the previous challenges and pages I had in 3.0.0? Thanks for your help.

Actually the error message text is longer:

sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such column: pages.format [SQL: SELECT pages.id AS pages_id, pages.title AS pages_title, pages.route AS pages_route, pages.content AS pages_content, pages.draft AS pages_draft, pages.hidden AS pages_hidden, pages.auth_required AS pages_auth_required, pages.format AS pages_format FROM pages WHERE pages.route != ? AND pages.draft IS NOT 1 AND pages.hidden IS NOT 1] [parameters: ('index',)] (Background on this error at: http://sqlalche.me/e/e3q8) // Werkzeug Debugger

sqlalchemy.exc.OperationalError

sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such column: pages.format [SQL: SELECT pages.id AS pages_id, pages.title AS pages_title, pages.route AS pages_route, pages.content AS pages_content, pages.draft AS pages_draft, pages.hidden AS pages_hidden, pages.auth_required AS pages_auth_required, pages.format AS pages_format FROM pages WHERE pages.route != ? AND pages.draft IS NOT 1 AND pages.hidden IS NOT 1] [parameters: ('index',)] (Background on this error at: http://sqlalche.me/e/e3q8)

Traceback (most recent call last)

  • File "/home/student/.local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1283, in _execute_context

                        for fn in self.dialect.dispatch.do_execute:
                            if fn(cursor, statement, parameters, context):
                                evt_handled = True
                                break
                    if not evt_handled:
                        self.dialect.do_execute(
                            cursor, statement, parameters, context
                        )
     
                if self._has_events or self.engine._has_events:
                    self.dispatch.after_cursor_execute(
  • File "/home/student/.local/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 590, in do_execute

     
        def do_executemany(self, cursor, statement, parameters, context=None):
            cursor.executemany(statement, parameters)
     
        def do_execute(self, cursor, statement, parameters, context=None):
            cursor.execute(statement, parameters)
     
        def do_execute_no_params(self, cursor, statement, context=None):
            cursor.execute(statement)
     
        def is_disconnect(self, e, connection, cursor):
  • The above exception was the direct cause of the following exception:
  • File "/home/student/.local/lib/python3.8/site-packages/flask/app.py", line 2464, in __call__

     
        def __call__(self, environ, start_response):
            """The WSGI server calls the Flask application object as the
            WSGI application. This calls :meth:`wsgi_app` which can be
            wrapped to applying middleware."""
            return self.wsgi_app(environ, start_response)
     
        def __repr__(self):
            return "<%s %r>" % (self.__class__.__name__, self.name)
  • File "/home/student/.local/lib/python3.8/site-packages/flask/app.py", line 2450, in wsgi_app

                try:
                    ctx.push()
                    response = self.full_dispatch_request()
                except Exception as e:
                    error = e
                    response = self.handle_exception(e)
                except:  # noqa: B001
                    error = sys.exc_info()[1]
                    raise
                return response(environ, start_response)
            finally:
  • File "/home/student/.local/lib/python3.8/site-packages/flask_restx/api.py", line 639, in error_router

            if self._has_fr_route():
                try:
                    return self.handle_error(e)
                except Exception as f:
                    return original_handler(f)
            return original_handler(e)
     
        def handle_error(self, e):
            """
            Error handler for the API transforms a raised exception into a Flask response,
            with the appropriate HTTP status code and body.
  • File "/home/student/.local/lib/python3.8/site-packages/flask/app.py", line 1867, in handle_exception

                # if we want to repropagate the exception, we can attempt to
                # raise it with the whole traceback in case we can do that
                # (the function was actually called from the except part)
                # otherwise, we just raise the error again
                if exc_value is e:
                    reraise(exc_type, exc_value, tb)
                else:
                    raise e
     
    <

Update: I solved my Upgrade issue. For anyone with the same issue the solution is a bit tedious but it works:

Install version 3.1 Import the 3.0.0 backup.
Export as a 3.1 backup.
Install version 3.2.0 import the 3.1 backup.
Export as a 3.2 backup.
Install the latest version and install the 3.2 backup.

Hello, I get an error when trying to run CTFd3.1.1 which I cannot find a solution for online. If you know how to resolve this, please let me know.

ImportError: cannot import name ‘escape’ from ‘jinja2’ (/usr/local/lib/python3.7/site-packages/jinja2/init.py)