code: def try_mongodb_opts(self, host="localhost", database_name='INGInious'):
          
          try:
              mongo_client = MongoClient(host=host)
          except Exception as e:
              self._display_warning("Cannot connect to MongoDB on host %s: %s" % (host, str(e)))
              return None
  
          try:
              database = mongo_client[database_name]
          except Exception as e:
              self._display_warning("Cannot access database %s: %s" % (database_name, str(e)))
              return None
  
          try:
              GridFS(database)
          except Exception as e:
              self._display_warning("Cannot access gridfs %s: %s" % (database_name, str(e)))
              return None
  
          return database
docs: Try MongoDB configuration